create two lists from a given list where odd elements will go to list odd and even elements to list even.


list_odd=[]
list_even=[]
list_x=[*range(1,25)]
print(list_x)

for i in list_x:
    if i%2==0:
        list_even.append(i)
    else:
        list_odd.append(i)

print("ODD list is ",list_odd)
print("Even list is ",list_even)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *