first we understand what is even and odd :
Even :
Even number means those numbers which are divided by 2 (two)
Odd :
Odd number means those numbers which are not divided by 2 (two)
Now we understand what is list :
List :
List is a group of elements
It can be store different type of elements
It is mutable object
It is represent in square bracket [ ]
Input :
s= [12,52,73,94,45,16]
Output :
even: 12
even: 52
odd : 73
even: 94
odd : 45
even: 16
Algorithm :
First we make a list of some elements
Then we use while loop for accessing elements
After that we use if and else for checking the elements
And at last print even and odd numbers
#Python program to print odd numbers in a List s= [12,52,73,94,45,16] n=0 # initialization while n<len(s): if s[n]%2==0: # condition check print("even:" ,s[n]) # if True else: print("odd :",s[n]) # if False n=n+1 output: even: 12 even: 52 odd : 73 even: 94 odd : 45 even: 16
For more python program practice :
Find the number is Armstrong number or not // python program
Find the Duplicate Elements in the List – Python List Program