コード例 #1
0
ファイル: ch3sphere.py プロジェクト: justinta89/Work
def main():
    radius = getInputs()
    sphere = Sphere(radius)
    surface = sphere.surfaceArea()
    vol = sphere.volume()

    print("\nSurface Area: {0:0.3f} \nVolume: {1:0.3f}".format(surface, vol))
コード例 #2
0
ファイル: exercise_9.py プロジェクト: toddt67878/zelle-python
def main():
    r = eval(input("What is the radius of your sphere?  "))
    s = Sphere(r)
    A = s.surfaceArea()
    V = s.volume()
    print("The volume of your sphere is {0:0.1f}.".format(V))
    print("The area of your sphere is {0:0.1f}.".format(A))
コード例 #3
0
def main():
    print("This program calculates the volume and surface area of a sphere.")
    radius = eval(input("Please enter a radius: "))
    sphere = Sphere(radius)

    print("The volume is", sphere.volume(), " and the surface area is",
          sphere.surfaceArea())
コード例 #4
0
def main(args):
    radius = int(args[1])

    print("The radius of the sphere is %d" % (radius))
    s1 = Sphere(radius)
    print("The surface area of sphere is ", s1.surfaceArea())
    print("The volume of sphere is ", s1.volume())