File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -57,3 +57,6 @@ Automatically change home wallpaper adding a random quote and stock tickers on i
5757
5858## Script 12 - Star Pattern
5959Create a star pattern pyramid
60+
61+ ## Script 13 - compound interest calculator
62+ calculate compound interest
Original file line number Diff line number Diff line change 1+ print ('How many years will you be saving?' )
2+ years = int (input ('Enter years: ' ))
3+
4+ print ('How much money is currently in your account?' )
5+ principal = float (input ('Enter current amount in account: ' ))
6+
7+ print ('How much money do you plan on investin monthly?' )
8+ monthly_invest = float (input ('Enter amount: ' ))
9+
10+ print ('What do you estimate will be the yearly interest of this investment?' )
11+ interest = float (input ('Enter interest in decimal numbers (10% = 0.1): ' ))
12+ print (' ' )
13+
14+ monthly_invest = monthly_invest * 12
15+ final_amount = 0
16+
17+ for i in range (0 , years ):
18+ if final_amount == 0 :
19+ final_amount = principal
20+
21+ final_amount = (final_amount + monthly_invest ) * (1 + interest )
22+
23+ print ("This is how much money you would have in your account after{} years: " .format (years ) + str (final_amount ))
You can’t perform that action at this time.
0 commit comments