Answer to Question #230821 in Python for Assignment

Question #230821
Write a python program that takes 10 inputs from the user, and then prints how many inputs are odd and how many inputs are even. Use for loop.

Sample input:

2

6

8

3

9

2

6

4

3

7

Sample Output:

Even numbers = 6, Odd numbers = 4
Notice: I want this answer in different way without using append, format, len etc.
1
Expert's answer
2021-08-30T01:35:44-0400
odd = 0
for _ in range(10):
    if int(input()) % 2:
        odd += 1
print(f'Even numbers = {10 - odd}, Odd numbers = {odd}')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS