编程练习之大于平均值比较输出器
#!/usr/bin/python3
BlogPost_2023 = (3, 2, 12, 6, 6, 6, 5, 5, 1, 3, 1, 4)
def averages (data):
total = 0
sum = 0
for i in data:
total += i
sum += 1
average = total / sum
return average
for i in range(len(BlogPost_2023)):
if BlogPost_2023[i] > averages(BlogPost_2023):
print (i+1 ,"月的博文数超过了平均值,是", BlogPost_2023[i],"篇!")