import random
N = [random.randint(0, 100) for i in range(10)]
print ("Array is:", N)
sum_less_50 = 0
Count_less_50 = 0
sum_more_50 = 0
Count_more_50 = 0
for elem in N:
if elem >= 50:
Count_more_50 += 1
sum_more_50 += elem
else:
Count_less_50 += 1
sum_less_50 += elem
print("Awerage of nums, that < 50: ", end = "")
if Count_less_50 > 0:
print(sum_less_50 / Count_less_50)
else:
print(0)
print("Awerage of nums, that >= 50: ", end= "")
if Count_more_50 > 0:
print(sum_more_50 / Count_more_50)
else:
print(0)
Можно более точный скриншот.
Объяснение: