代码拉取完成,页面将自动刷新
import math
COUNT = 10 # Total numbers
sum = 0 # Store the sum of the numbers
squareSum = 0 # Store the sum of the squares
# Create numbers, find its sum, and its square sum
for i in range(COUNT):
# Get a new number
number = eval(input("Enter a number: "))
# Add the number to sum
sum += number
# Add the square of the number to squareSum
squareSum += number ** 2 # Same as number*number
# Find mean
mean = sum / COUNT
# Find standard deviation
deviation = math.sqrt((squareSum - sum * sum / COUNT) / (COUNT - 1))
# Display result
print("The mean is " + str(mean))
print("The standard deviation is " + str(deviation))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。