Loading

Paste #pxhdxo9yw

  1. print("Enter the range, values separated by comma:")
  2. [a,b] = [int(z) for z in input().split(',')]
  3. odd = set(['1','3','5','7','9'])
  4. l = []
  5. for n in range(a,b+1):
  6.     # create a set of characters from the number
  7.     s = set(str(n))
  8.     # If there are only even digits, the intersection with the odd ones is empty:
  9.     if odd & s == set([]):
  10.         l.append(n)
  11. print(*l, sep=',')

Comments