Question: Write a Python script that computes monthly interest payments for a home or car loan. Inputs: p = Loan amount (principal) r = Interest rate

  • Write a Python script that computes monthly interest payments for a home or car loan.
    Inputs: p = Loan amount (principal)
    r = Interest rate in percent
    n = Number of years (duration of loan)
    Output: m = Monthly payment
    Here is the formula:
    m =
    p r / 1200.0
    1 - (1.0 + r / 1200.0) 12 n
  • Use prompts for input to let the user know what to input; use text to explain what the output means.
  • Round the monthly payment is to the nearest cent.
  • Use Cel2Fahr and Distance as examples.
  • Optionally: validate p, r, and n with if statements to insure that they are all positive.
  • Pseudocode for Project 1, including input validation:
    Input principal using prompt "Enter amount of loan: ", assign to variable p. If p is less than 0, print error message, exit program. End Input interest rate using prompt "Interest rate in percent: ", assign to variable r. If r is less than 0, print error message, exit program. End Input term using prompt "Number of years: ", assign to variable n. If n is less than 0, print error message, exit program. End Compute monthly payment using formula, assign to variable m. Output monthly payment m.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!