#Write a Python program to count the number of even and odd numbers from a series of numbers.
numbers=[1,2,3,4,5,6,7,8,9]
count_odd=0
count_even=0
for number in numbers:
if number%2==0 :
count_even += 1
else:
count_odd +=1
print("even number in numbers is:",count_even)
print("odd number in numbers is:",count_odd)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter