Answers for "Use the "map" function to find all the odd numbers and the even numbers in the list. Print 0 for odd and 1 for even. in python"

0

Use the "map" function to find all the odd numbers and the even numbers in the list. Print 0 for odd and 1 for even. in python

nums = [43, 20, 53, 12, 53, 5, 3, 2]

even = []
odd = []

for i in nums:
    if (i % 2 == 0):
        even.append(i)
    else:
        odd.append(i)

print("Even List: ", even)
print("Odd List: ", odd)
Posted by: Guest on October-12-2021

Code answers related to "Use the "map" function to find all the odd numbers and the even numbers in the list. Print 0 for odd and 1 for even. in python"

Python Answers by Framework

Browse Popular Code Answers by Language