User Defined Functions
Can you call a variable from one user-defined function into another user defined function?
Answered by themining72 (49) [earned 5 cycles]
# User Radius def radius(): radius = input("Enter Radius: ") r = float(radius) print("Radius =", r) return r # Calculations def calculate(r): area = 3.14 * r * r print ("Area =" , area) # Magic n = input("If you would like to continue, type yes with a SMALL/LOWERCASE Y.") while n == "yes": calculate(radius())
The above should work, changes:
Line 9now accepts a variable.