Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

program to split the list between even and odd python

# Python code to split into even and odd lists
l=[]
n=int(input("enter the  length of the list:"))
for i in range(1,n+1):
    a=int(input("enter element"))
    l.append(a)
print(l)
even=[]
odd=[]
for j in l:
    if j%2==0:
        even.append(j)
    else:
        odd.append(j)
print("even number ",even)
print("odd  number", odd)
 
PREVIOUS NEXT
Tagged: #program #split #list #odd #python
ADD COMMENT
Topic
Name
3+4 =