0% found this document useful (0 votes)
43 views1 page

I Have Moved The Last Two Lines Monthly Calculate (Loan, Down - Payment, Rate, Dur) Print (" Your Monthly Payment Will Be %.2f" % Monthly)

This document summarizes corrections made to code calculating a car payment amount. It explains that a multiplication was written incorrectly, an else statement was added to handle calculating the payment if inputs are not negative, indentation of the calculate function was fixed, and the payment calculation and print statement were moved into the new else block.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

I Have Moved The Last Two Lines Monthly Calculate (Loan, Down - Payment, Rate, Dur) Print (" Your Monthly Payment Will Be %.2f" % Monthly)

This document summarizes corrections made to code calculating a car payment amount. It explains that a multiplication was written incorrectly, an else statement was added to handle calculating the payment if inputs are not negative, indentation of the calculate function was fixed, and the payment calculation and print statement were moved into the new else block.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Explanations:

1. In line 30, p * math(rt) is wrong. “rt” is a product multiple so we have to


use asterisk (*) in between r and t in order to multiply r and t.
2. In the function get_car_payment(), there’s no else statement handling
the actual task of get_car_payment - to give the user the estimated car
payment he/she has to make. So, below the if condition where we check if
the input variables are negative, we are creating an “else” branch where
we call the calculate (l, down, apr, duration) function in order to
calculate the final monthly payment that the user has to make.
3. The calculate() function was given with wrong indentation, like it was a
continuation of the get_car_payment() function, which it wasn’t. So I have
removed the wrong indent, taken the entire function body one tab left to
its appropriate indentation.
4. I have moved the last two lines

monthly = calculate(loan,down_payment,rate,dur)
print("**Your monthly payment will be %.2f" % monthly)

into the else part I’ve discussed in (2) in order to get the total monthly
payment to be made and print it to the user.

You might also like