[Solved] python not understanding simple math question [closed]


What you shared is not valid python code. Here is an example of code that will accomplish what you are asking:

# define function:
def CalculateMortgage(p, i, n):

    # calculate numerator:
    numerator = p * (i *(1+i) ** n)

    # calculate denominator:
    denominator = ((1+i) ** n - 1)

    # calculate mortgage:
    mortgage = numerator/denominator 

    # return result:
    return mortgage


# set variables:
p = 1
i = 1
n = 1

# call function:
mortgage = CalculateMortgage(p, i, n)

# print result:
print('Your mortgage is: ' + str(mortgage))

solved python not understanding simple math question [closed]