This commit is contained in:
2025-12-11 18:06:09 +05:00
parent bfa7413f9c
commit e98dd2f107
35 changed files with 0 additions and 0 deletions

28
operators_21.py Normal file
View File

@@ -0,0 +1,28 @@
n = int(input("Введите количество учеников: "))
boys_total = 0
boys_count = 0
girls_total = 0
girls_count = 0
for i in range(n):
height = int(input(f"Введите рост ученика {i + 1} (для мальчиков - отрицательное): "))
if height < 0:
boys_total += -height
boys_count += 1
else:
girls_total += height
girls_count += 1
if boys_count > 0:
avg_boys = boys_total / boys_count
print(f"Средний рост мальчиков: {avg_boys:.1f} см")
else:
print("Мальчиков нет")
if girls_count > 0:
avg_girls = girls_total / girls_count
print(f"Средний рост девочек: {avg_girls:.1f} см")
else:
print("Девочек нет")