Computer Science, asked by kolaramakrishana04, 6 months ago

2) Take 20 integer inputs from user and print the following:
number of odd numbers
number of even numbers

Answers

Answered by jai696
5

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

ints = [int(n) for n in input("enter 20 ints: ").split()]

even_ints = [str(n) for n in ints if n % 2 == 0]

odd_ints =[str(n) for n in ints if n % 2 != 0]

print(f"Odd nums: {', '.join(odd_ints)}\nEven nums: {', '.join(even_ints)}")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions