| Old revision #pxhdxo9yw | New revision #pp4mfiqxw | ||
|---|---|---|---|
| 1 | print("Enter the range, values separated by comma:") | 1 | print("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(',')] |
| 3 | odd = set( | 3 | odd = set('13579') |
| 4 | l = [] | 4 | l = [] |
| 5 | for n in range(a,b+1): | 5 | for 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) |
| 11 | print(*l, sep=',') | 9 | print(*l, sep=',') |