1.

Write a list comprehension that builds a list of the even numbers from 1 to 10 (inclusive).

Answer»

foo = [x for x in range(l, 11) if (x % 2) = = 0] print foo [2,4,6,8,10]



Discussion

No Comment Found