Python:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
even_counter = 0
odd_counter = 0
for i in a:
if i % 2 == 0:
even_counter += 1
else:
odd_counter += 1
print("Четных:", even_counter)
print("Нечетных:", odd_counter)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Python:
a = [1, 2, 3, 4, 5, 6, 7, 8, 9]
even_counter = 0
odd_counter = 0
for i in a:
if i % 2 == 0:
even_counter += 1
else:
odd_counter += 1
print("Четных:", even_counter)
print("Нечетных:", odd_counter)