Write a Python program to count the number of even and odd numbers from a series of numbers and print the result
Topic: Write a Python program to count the number of even and odd numbers from a series of numbers and print the result
Solution
x = (1, 2, 3, 4, 5, 6, 7, 8, 9) odd = even = 0 for i in x: if i % 2 == 0: even = even + 1 else: odd = odd + 1 print("Even Numbers are: ", even) print("Odd Numbers are: ", odd)
List all Python Programs