Find odd and even no and store into different file in python
Answers
Answered by
0
def Split(mix):
ev_li = []
od_li = []
for i in mix:
if (i % 2 == 0):
ev_li.append(i)
else:
od_li.append(i)
print("Even lists:", ev_li)
print("Odd lists:", od_li)
# Driver Code
mix = [2, 5, 13, 17, 51, 62, 73, 84, 95]
Split(mix)
Output:
Even lists: [2, 62, 84] Odd lists: [5, 13, 17, 51, 73, 95]
Similar questions