You are on page 1of 2

""" take a list and find its sum and average

list1=[10,20,30,40,50]

print("sum=", sum(list1))

print("average=", sum(list1)/len(list1))"""

"""# take a list and display the content of the list

list1=[10,20,30,40,50]

for i in range(len(list1)):

print(list1[i])"""

"""#read a list of integers and check for the given element

a=[int(i) for i in input().split()]

b= int(input("Enter the element"))

if b in a:

print("Yes")

else:

print("No")"""

"""#read a list of elements by allowing repetation and then del all the repeated elements from the list

print("Enter the elements of list")

l1=[int(i) for i in input().split()]

l1.sort()

for i in l1:

if l1.count(i)>1:

a=l1.index(i)

del l1[a:a+1]

print(list(l1))"""

"""#using pop
print("Enter the elements of list")

l1=[int(i) for i in input().split()]

l1.sort()

for i in l1:

if l1.count(i)>1:

l1.pop(l1.index(i))

print(list(l1))"""

#Read a list and display the even and odd numbers separately

print("Enter the elements of list")

l2=[]

l3=[]

l1=[int(i) for i in input().split()]

for i in l1:

if i%2==0:

l2.append(i)

else:

l3.append(i)

print(l2)

print(l3)

You might also like