I am just learning functions so please go easy on me! I do not have a problem calling the function with nothing as a parameter but when I put a parameter in and try to call it. It does not work?
This is what I am supposed to do:
Code a function called
getFloatInput
that receives a string as a parameter to be used as the prompt input text and it returns a float. You will be calling this function for each value to be inputted and assign the function’s return value and assign to each of the listed variables. For example:fSalesPrice = getFloatInput(“Enter property sales value:”)
def getFloatInput(sales):
salesPrice = 0
while True:
try:
salesPrice = float(input("Enter property sales value: "))
if salesPrice <= 0:
print("Enter a numeric value greater than 0")
return salesPrice
except ValueError:
print("Input must be a numeric value")
return salesPrice
getFloatInput(salesPrice)