Python program to Select Even Numbers from List

x = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
y = [i for i in x if i % 2 ==0]
print(y)

 

 

 

Output:

[2, 4, 6, 8, 10, 12, 14, 16]

 

Subscribe For Daily Updates