Monday, March 23, 2020

even or odd using python language

list_of_numbers=[1,2,3,4,5,6]
for number in list_of_numbers:
    if number%2==0:
        print(number,"is even")
    else :
        print(number,"is odd")

print("end of the code")

output:
1 is odd
2 is even
3 is odd
4 is even
5 is odd
6 is even
end of the code

No comments:

Post a Comment

python class topic video