Page 1 of 1

Reputation:

# Creating a mortgage calculator in python -- Help!

Posted 16 September 2010 - 11:37 AM

So I need to create a mortgage calculator in python.

The program must get the following information and then execute a formula to give an answer

The amount of money borrowed
The number of years for which the money was borrowed
The annual percentage rate for the loan

This is what I have so far, although I'm not sure if I'm doing it right (newbie). So i've got it printing the data and asking for inputs, but then I'm not sure how to go about executing the data to give out a number.

```# Get information from user
print 'CALCULATOR FOR MORTGAGE LOANS'
loan_str = raw_input ("Amount of loan:")
loan = eval(loan_str)
years_str = raw_input("Number of years:")
years = eval(years_str)
rate_str = raw_input ("Annual percentage rate:")
rate = eval(rate_str)

```

Formula is

here is an example program:

Help is appreciated!

Is This A Good Question/Topic? 0

## Replies To: Creating a mortgage calculator in python -- Help!

### #2 Motoma

Reputation: 452
• Posts: 798
• Joined: 08-June 10

## Re: Creating a mortgage calculator in python -- Help!

Posted 16 September 2010 - 11:48 AM

I'm not sure how much assistance you are looking for, so I'll just give you a little nudge in the right direction.

You're off to a good start, the next step would be to play around the Python's math functions. Try adding this to the end of your program:
```months = years * 12
print months

```

Come back if you need more help.