Print Odd Even Negative Integer Count 1

Print Odd Even Negative Integer Count

n,neg,odd,eve,m=int(input()),0,0,0,[int(i) for i in input().split()]
for i in m:
    if i<0:
    elif i%2==0 :
print("{0} {1} {2}".format(odd,eve,neg))

Here is what the above code is Doing:
1. Taking input from the user and storing it in the variable m.
2. Initializing the variables odd, eve and neg to 0.
3. Iterating through the list m and checking if the number is odd, even or negative.
4. If the number is odd, increment odd by 1.
5. If the number is even, increment eve by 1.
6. If the number is negative, increment neg by 1.
7. Print the values of odd, eve and neg.

Similar Posts