Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: kivy stuck in fullscreen in jupyter notebook macbook 
Python :: how to make input box if else statement in tkinter 
Python :: how to remove axis in matplotlib 
Python :: dataframe concatenate 
Python :: numba for python 
Python :: list of list to numpy array 
Python :: 1d random walk in python stack exchange 
Python :: Python3 boto3 put object to s3 
Python :: how to make a bot send whatever you dm it into a server discord.py 
Python :: split custom pytorch dataset 
Python :: check how many days old file is python 
Python :: binary search iterative 
Python :: keras embedding 
Python :: how to add column to heroku postgres in my django app 
Python :: check if input is pandas dataframe 
Python :: getch backspace pytohn 
Python :: round to the nearest 0.5 
Python :: python enable pyqt errors 
Python :: # add keys to existing dictionary 
Python :: ord() python 
Python :: Django Redirect Depending On Request Method 
Python :: transform dictionary keys python 
Python :: using pypyodbc 
Python :: tkinter standard dialogs message 
Python :: python function 
Python :: argparse parse path 
Python :: convert pdf to word doc in python 
Python :: minio python make an object 
Python :: how to divide string in python 
Python :: end without space in python 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =