Files
Python-for-Geeks/Chapter06/comprehension/gencomp1.py
T
2021-08-13 11:44:51 +05:30

6 lines
111 B
Python

#gencomp1.py
list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
gen1 = (x for x in list1 if x % 2 ==0)
print(list(gen1))