def main()
sum=0
count=0
xStr=input(“please enter a number”)
while xStr!= " ":#遇到空格时自动结束
x=eval(xStr)
sum = sum + x
count=count+1
xStr=input(“please enter a number”)
print(“average is:”,sum / count)
main()
平均数算法(可手动输入数字)
最新推荐文章于 2022-05-24 22:10:21 发布