Public Group

This topic is 3799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

A deposit of $50 is made the 1st day of each month in a savings account that pays 12% compounded monthly. What is the balance at the end of two years?  monthly_deposit = 50 interest_rate = .12 term_length = 24 #number of months acct_balance = 50 print "Initial Balance: ", acct_balance print "Monthy Deposit: ", monthly_deposit print "Month Compounded Interest Rate: ", interest_rate*100, "%" print "Length of Term: ", term_length, " Months" for i in range (term_length-1): #runs the loop term_length times acct_balance = acct_balance+(acct_balance*interest_rate)+monthly_deposit print "\nBalance at end of ", term_length, " month term: ", "$", acct_balance

raw_input()


MY OUTPUT: http://img242.imageshack.us/img242/8608/61308974ze5.jpg Thanks! [Edited by - musafir2007 on July 17, 2008 11:44:35 PM]

##### Share on other sites
for i in range (term_length-1): #runs the loop term_length times
acct_balance = acct_balance+(acct_balance*interest_rate)+monthly_deposit

Considering the $50 is paid in on the first day of the month, and the interest is paid at the end of the month. Wouldn't you want to increase the account balance by the monthly deposit and then work out the interest? begin loop for each month add the monthly deposit to the account balance increase the account balance using the interest rate end loop EDIT: Just noticed, your initializing the account balance to$50 so my loop would be wrong, but if you was to start with an empty account then you would need to add the monthly ammount to the balance and then add interest to the new total.

##### Share on other sites
^^ ok, so what I did works right? thanks!

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633672
• Total Posts
3013272
×