forked from snehinsen/quickcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterest.py
More file actions
26 lines (22 loc) · 773 Bytes
/
interest.py
File metadata and controls
26 lines (22 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
option = int(input("Simple or compound interest? (1, 2): "))
if option == 1:
principle = float(input("PPrinciple: "))
rate = float(input("Rate (%): "))
time = float(input("Time: "))
interest = principle * rate * time / 100
print("Simple interest: ", interest)
principle += interest
print("Amount: ", principle)
if option == 2:
principle = float(input("PPrinciple: "))
rate = int(input("Rate (%): "))
time = int(input("Time: (years)"))
principle2 = principle
interest = 0
totalInterest = 0
for i in range(time):
interest = principle * rate / 100
totalInterest += interest
principle += interest
print("Interest: ", totalInterest)
print(f"Amount: {(principle2 + totalInterest):.2f}")