CBSE Class 12 Computer Science Question 99 of 105

Python Revision Tour II — Question 6

Back to all questions
6
Question

Question 6

Write a program that creates a list of all the integers less than 100 that are multiples of 3 or 5.

Solution
a = []
for i in range(0,100):
    if (i % 3 == 0) or (i % 5 == 0) :
        a.append(i) 
print(a)
Output
[0, 3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25, 27, 30, 33, 35, 36, 39, 40, 42, 45, 48, 50, 51, 54, 55, 57, 60, 63, 65, 66, 69, 70, 72, 75, 78, 80, 81, 84, 85, 87, 90, 93, 95, 96, 99]
Answer