Skip to content

Commit 22c4a36

Browse files
authored
Merge pull request #19 from thanmaisai/master
added a CI calculator.
2 parents bbb70ed + 5a2b516 commit 22c4a36

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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
5959
Create a star pattern pyramid
60+
61+
## Script 13 - compound interest calculator
62+
calculate compound interest

calculate_CompoundIntrest.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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))

0 commit comments

Comments
 (0)