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)
▶ RUN

Output/ Explanation:

[0, 4, 8, 12, 16, 20]

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad