Monthly Interest Rate

This is the place for queries that don't fit in any of the other categories.

Monthly Interest Rate

Postby bridgetroche » Fri Apr 04, 2014 4:45 am

This is the problem I am working with.

Formatting investment data. The function moInterest() calculates the amount of interest paid in one month on a loan at a certain interest rate. Print a labelled return value from one call of moInterest() using the following output format, including the indicated number of digits after the decimal points:
Code: Select all
The monthly interest due on a loan with remaining principal $842.57 at an annual interest rate of 7.8% is $5.48.

The code I have right now is:
Code: Select all
def mointerest(princip,intrate):
    interest = float(intrate/100)
    final = interest * princip
    print("The monthly interest due on a loan with remaining principal $", princip, "at an annual interest rate of ", intrate, "% is $", final)

mointerest(842.57, .78)

Unfortunately, I keep ending up with $6.57, where it should be $5.48. Any ideas on what I'm doing wrong? Thanks for the help.
Last edited by Mekire on Fri Apr 04, 2014 4:50 am, edited 2 times in total.
Reason: First post lock; code tags.
Posts: 1
Joined: Fri Apr 04, 2014 4:44 am

Re: Monthly Interest Rate

Postby Mekire » Fri Apr 04, 2014 5:04 am

So you got a few numbers wrong. The interest rate is 7.8%, not 0.78%. Also that is the anual interest rate; you are looking for the monthly interest payment. I imagine you need a 12 somewhere.

Take another shot.
New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

Return to General Coding Help

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests