2024-11-27 04:11:08
n = int(input("请输入数量"))
sum1 = 0
i = 1
while i <= n:
node = float(input("请输入数"))
sum1 = sum1 + node
i ++
print(sum1/n)
2024-11-27 05:24:07
求平均数,查看下图:
结果:
2024-11-27 06:47:37
a = [ 这里存放你要算的n个数 ]
b = 0
num = 0
for i in a:
num += 1
b += i
average = b/n
print(average)
就可以了
得出是3.5
2024-11-27 06:18:05
2024-11-27 06:06:46