Python program to Get the Number of Even and Odd Numbers
import random
x = []
for i in range(10):
x.append(int(random.random()*1000))
print(x)
even = odd =0
for i in x:
if i%2 == 0:
even += 1
else:
odd += 1
print("The number of even = ", even)
print("The number of odd = ", odd)
Output:
|
[6, 983, 158, 91, 742, 267, 742, 837, 96, 917]
[721, 10, 532, 347, 244, 655, 964, 926, 890, 344]
|