Python Tutorial

Monday, February 18, 2013

Code snippet: Array initilize by odd number

a=[i for i in range(0,20) if i%2]
print a

Output:
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]

0 comments:

Post a Comment