Python program to Print Odd Numbers in Set

odd=set([x*2+1 for x in range(1,10)])
print("Odd Numbers:", odd)
prime=set()
for i in range(2,25):
  j=2
  flag=0
  while j<i/2:
    if i%j==0:
      flag=1
    j+=1
  if flag==0:
    prime.add(i)
print("Prime Numbers:", prime)

OUTPUT:




Python Program to Print Prime Numbers and Odd Numbers using Set

Leave a Comment