python 2.7 - I need help writing this program. I have no idea how to do it to be honest. Here's the prompt -
write program prompts user radius , height of 3-dimensional cone , calculates , prints surface area , volume of cone. calculation of surface area , volume done in functions, gathering of inputs
import math def surfaceareaofcone(radius, height): return math.pi * radius * (radius + math.sqrt(height * height + radius * radius)) def volumeofcone(radius, height): return math.pi * (radius * radius) * height/3 radius = float(raw_input("enter radius: ")) height = float(raw_input("enter height: ")) print("surface area:" + repr(surfaceareaofcone(radius, height))) print("volume: " + repr(volumeofcone(radius, height)))
Comments
Post a Comment