Count Even Odd Number


6. Count the number of even and odd numbers from a series of number.


#Solution:

numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9)
count_odd = 0count_even = 0for x in numbers:
    if not x % 2:
        count_even+=1    else:
        count_odd+=1print("Numbers of even numbers :",count_even)
print("Numbers of odd numbers :",count_odd)





No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...