Exercise 212
Create a python program that determines the set of odd integers less than or equal to 100 that are multiple of 3.
Solution
# initialization of the requested set
A = set({})
#Browsing through the integers from 0 to 100
for i in range(0, 101):
if i%3 == 0 and i%2 != 0:
A.add(i)
# display the set of odd integers and multiples of 3
print("A = ", A)
#output: A = {33, 3, 99, 69, 39, 9, 75, 45, 15, 81, 51, 21, 87, 57, 27, 93, 63}
Younes Derfoufi
my-courses.net
my-courses.net