Loading

Revision differences

Old revision #pxhdxo9ywNew revision #pp4mfiqxw
1print("Enter the range, values separated by comma:")  1print("Enter the range, values separated by comma:")  
2[a,b] = [int(z) for z in input().split(',')]  2[a,b] = [int(z) for z in input().split(',')]  
3odd = set(['1','3','5','7','9'])  3odd = set('13579')
4l = []  4l = []  
5for n in range(a,b+1):  5for n in range(a, b + 1):
6    # create a set of characters from the number  6    # If there are only even digits, the set is disjoint with odd:
7    s = set(str(n))  7    if odd.isdisjoint(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)  8        l.append(n)  
11print(*l, sep=',') 9print(*l, sep=',')