返回列表 發帖

Help with writing python math programs

How do you write a code for calculating arithmetic and geometric mean using python?  I want to make it so that users can input as many numbers as they want to calculate.   

I only got to this far (but it's not correct):

print "This is a program that calculates arithmetic mean."
x = int( raw_input("Please enter the first number: ") )
y = int( raw_input("Please enter the second number: ") )
z = int( raw_input("Please enter the third number: ") )
print "The arithmetic mean of the three numbers is", (x+y+z)/3, "."

返回列表