214k views
3 votes
Assignment 4: Evens and Odds

Assignment 4: Evens and Odds-example-1
Assignment 4: Evens and Odds-example-1
Assignment 4: Evens and Odds-example-2
User Chiyono
by
8.3k points

1 Answer

3 votes

n = int(input("How many numbers do you need to check? "))

even = 0

odd = 0

for x in range(n):

num = int(input("Enter number: "))

if num % 2 == 0:

print(str(num) + " is an even number.")

even += 1

else:

print(str(num) + " is an odd number.")

odd += 1

print("You entered "+str(even)+" even number(s).")

print("You entered "+str(odd)+" odd number(s).")

This works for me. Best of luck.

User Kelvin Hu
by
8.0k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.