diff --git a/Solutions/Module4MortgageCalculatorChallengeSolution.py b/Solutions/Module4MortgageCalculatorChallengeSolution.py index ddb9c28..d069481 100644 --- a/Solutions/Module4MortgageCalculatorChallengeSolution.py +++ b/Solutions/Module4MortgageCalculatorChallengeSolution.py @@ -14,14 +14,14 @@ #Convert the strings into floating numbers so we can use them in teh formula loanDurationInYears = float(strLoanDurationInYears) loanAmount = float(strLoanAmount) -interestRate = float(strInterestRate) +interestRate = float(strInterestRate)/12 #Since payments are once per month, number of payments is number of years for the loan * 12 numberOfPayments = loanDurationInYears*12 #Calculate the monthly payment based on the formula -monthlyPayment = loanAmount * interestRate * (1+ interestRate) * numberOfPayments \ - / ((1 + interestRate) * numberOfPayments -1) +monthlyPayment = loanAmount * interestRate * (1 + interestRate)** numberOfPayments \ +/((1 + interestRate) ** numberOfPayments - 1) #provide the result to the user print("Your monthly payment will be " + str(monthlyPayment))