even and odd numbers of a list

# Print even and odd numbers of a list

Nterms = int(input("Enter number of terms in List:"))
L = []

print("Enter", Nterms, "numbers : ")
for idx in range(0,Nterms, 1):
ele = int(input())
L.append(ele)

print("Original list : ", L)

print("Odd numbers list : ")
for ele in L:
if(ele%2==1):
print(ele)

print("Even numbers list : ")
for ele in L:
if(ele%2==0):
print(ele)

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu