Programming Examples
Python program that creates a list of numbers from 1 to 20 that are divisible by 4
Write a python program that creates a list of numbers from 1 to 20 that are divisible by 4
Solution
divBy4=[ ]
for i in range(21):
if (i%4==0):
divBy4.append(i)
print(divBy4)
Output/ Explanation:
[0, 4, 8, 12, 16, 20]