python - Can someone point out the errors in this code? -
i'm beginner python programmer trying execute code don't quite know def function yet... can point out errors in code , how fix them?
import math def main(): radius = get_radius() calculate = cal_volume() dis = display() def get_radius(): rad = float(input("enter radius :")) return rad def cal_volume(radius): return 4/3*math.pi*radius**3 def display(cal_volume): print("the volume :",cal_volume) main()
you didn't provide parameters cal_volume()
, display()
in def main()
.
it should be:
import math def main(): radius = get_radius() calculate = cal_volume(radius) dis = display(calculate) # print out result? def get_radius(): rad = float(input("enter radius :")) return rad def cal_volume(radius): return 4/3*math.pi*radius**3 def display(cal_volume): print("the volume :",cal_volume) main()
Comments
Post a Comment