Python program to count numbers of even and odd elements in an array
Login/Signup to comment
2 comments on “Python program to count numbers of even and odd elements in an array”
×
30+ Companies are Hiring
Get Hiring Updates right in your inbox from PrepInsta
a=[1, 7, 8, 4, 5, 16, 8]
even_count=0
odd_count=0
for i in a:
if i%2==0:
even_count+=1
else:
odd_count+=1
print(even_count)
print(odd_count)
a = [1, 7, 8, 4, 5, 16, 8]
c=0
p=0
for i in a:
if(i%2==0):
c+=1
else:
p+=1
print(“even =”,c ,”odd =”, p)