interest - print...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
# Assignment 4 # # Yeuan-Shyuan(James) Cheng # StudentID: 301001191 # # interest.py # # calculate the compound interest of two year with # deposit of $50 every month # print "Calculate the balance after 2 years of $50 deposit every month" print "with annual of 12% compounded monthly. \n" p print "compounded interest function: Total = Principal( 1+ rate/year )^period \n" p principal = 0.00 # initial deposit p rate = 0.12 # annual interest rate r year =12.00 # compounded monthly 1 year has 12 months y print " Month %25s" % "Amount on deposit" #title for the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: print "=================================" #monthly balance p #for loop to calculate the result every month from 1 to 24 (25 not included) #1 year is 12 month, 2 years is 2*12=24 months. for month in range(1,25): principal = principal + 50.00 #deposit $50 every month amount = principal *( 1.0 + rate/year) ** month print "%4d%21.2f" % ( month, amount ) #print deposit for each month print "\nThe balance after 2 year is : %1.2f" % ( amount ) p...
View Full Document

Ask a homework question - tutors are online