January 24th, 2005, 07:56 PM
I am having trouble trying to decipher how to write a program in Python. The first thing is calculating the volume and surface area of a sphere from it radius, given as input. The formulas are V=4/3pir^3 and A=4pir^2. Thanks
January 24th, 2005, 08:12 PM
Moved from the PHP Development forum.
January 24th, 2005, 10:02 PM
open a file and type:
Originally Posted by jarchambo
radius = raw_input("what is the radius? ")
volume = ((4/3.0)*math.pi*(radius**3))
area = (4*math.pi*(radius**2))
print "The volume is: ", volume
print "The area is: ", area
raw_input("Press button to continue...")
save the file with a .py extension and run it.
January 25th, 2005, 12:38 AM