I have to write this same basic function six different times, changing the formula in the function each time. I need help getting the first function right.
we have a prompt like this for each of the functions we have to make: sp_comp_annual(present, interest, num_periods) - This function implements the formula for the Single Payment Compound Annual Factor. The three parameters correspond to the variables P, i, and n on the right side of the mathematical formula. The function will return the result of the computation, i.e., the value of F.
the formula for the current function is Compound Annual Factor F= P(1+i)^n
this is my current function
def sp_comp_annual(present, interest, num_periods):
present,
interest,
num_periods,
return present(1+interest)**num_periods
present = int(input("What is your present value of the money?:" ))
interest = float(input("What is your current interest?:" ))
num_periods = int(input("What is the number of interest periods?:" ))
F = sp_comp_annual(present,
interest,
num_periods,)
print(f"Compound Annual Factor: {F}")