forked from darkprinx/break-the-ice-with-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolution12.py
29 lines (19 loc) · 758 Bytes
/
solution12.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'''
Write a program, which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line
'''
my_list=[]
for num in range(1000,3001):
add_number=True
for letter in str(num):
if(int(letter)%2!=0):
add_number=False
break
if add_number:
my_list.append(str(num))
print(','.join(my_list))
# def check(item):
# return all(int(letter)%2==0 for letter in item)
# my_list=[str(num) for num in range(1000,3001)]
# print(','.join(list(filter(check,my_list))))
# my_list=[str(num) for num in range(1000,3001)]
# print(','.join(list(filter(lambda item: all(int(letter)%2==0 for letter in item),my_list))))