Friday, July 10, 2015

Program to create separate even and odd numbers from a list



num_list = [1,21,53,84,50,66,7,38,9]


  odd=[]
 even=[]
 for i in num_list:

 if i%2==0:
    even.append(i)
 else 
    odd.append(i)

print odd
print even

No comments:

Post a Comment