Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

segregate list in even and odd numbers python

# program that splits even and odd digit from inputed list.
list=eval(input("list of digits"))
even_list=[]
odd_list=[]
for i in list :
    if i%2==0 :
        even_list.append(i)
    else:
        odd_list.append(i)
print('even list :',even_list)
print('odd list  :',odd_list)
--------------------------------------------------------------------------------
output:
list of digits[0,1,2,3,4,5,6,7,8,9]
even list : [0, 2, 4, 6, 8]
odd list  : [1, 3, 5, 7, 9]
--------------------------------------------------------------------------------
Comment

PREVIOUS NEXT
Code Example
Python :: python remove during iteration 
Python :: mirror 2d numpy array 
Python :: python project ideas 
Python :: pygame left click 
Python :: cmd python -m 
Python :: how to clear command prompt python 
Python :: cv2.GaussianBlur() 
Python :: install django windows 
Python :: except do nothing python 
Python :: python os exists 
Python :: django session expire time 
Python :: middle value of a list in python 
Python :: coronavirus tips 
Python :: xaxis matplotlib 
Python :: discord.py check if user has role 
Python :: python matplotlib hist set axis range 
Python :: how to add special token to bert tokenizer 
Python :: how to change the datatype of a row in pandas 
Python :: registering static files in jango 
Python :: reset index with pandas 
Python :: next day in python without using datetime 
Python :: python know the number of a loop 
Python :: python sort 2d list 
Python :: plotly reverse y axis 
Python :: python ls 
Python :: how to save array python 
Python :: python square root 
Python :: python dataframe column string to integer python 
Python :: download pdf using python 
Python :: use python type hint for multiple return values 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =