Assignment 4 evens and odds
Write a program that will ask a user for how many numbers they would like to check. Then, using a for loop, prompt the user for a number, and output if that number is even or odd. Continue doing this as many times as the user indicated. Once the loop ends, output how many even numbers were entered and how many odd numbers were entered.

Sample Run 1
How many numbers do you need to check? 5
Enter number: 20
20 is an even number.
Enter number: 33
33 is an odd number.
Enter number: 4
4 is an even number.
Enter number: 77
77 is an odd number.
Enter number: 8
8 is an even number.
You entered 3 even number(s).
You entered 2 odd number(s).
Sample Run 2
How many numbers do you need to check? 3
Enter number: 10
10 is an even number.
Enter number: 3
3 is an odd number.
Enter number: 400
You entered 2 even number(s).
You entered 1 odd number(s).

Assignment 4 evens and odds Write a program that will ask a user for how many numbers they would like to check Then using a for loop prompt the user for a numbe class=

Respuesta :

I've added my own code in a picture below. I didnt really notice any error, which would cause problems in your code. The main issues I had with your code is purely readability. You should start using the format function along with the curly brackets to concatenate variables into strings. You should also start doing even += 1 instead of even = even + 1. I also tweaked your range function. Simply putting n makes it much easier to read and understand.

Ver imagen Cytokine