Odd and Even in a list

 Odd and Even in a list

QUESTION DESCRIPTION

Python Program to Put Even and Odd elements in a List into Two Different Lists

Input
First Line is the Number of Inputs
Second line is the elements of the list

Output
Print the Even List and Odd List


o=[]
e=[]
l=[]
a=int(input())
for i in range(0,a):
  v=int(input())
  l.append(v)
  if l[i]%2==0:
    e.append(l[i])
  else:
    o.append(l[i])
print("The even list",e)
print("The odd list",o)

Comments