-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompoudCalc.py
More file actions
30 lines (22 loc) · 774 Bytes
/
CompoudCalc.py
File metadata and controls
30 lines (22 loc) · 774 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
27
28
29
30
#Python coumpound interest calulator
principle = 0
rate = 0
time = 0
while principle <= 0:
principle = float(input("Enter the principle amount: "))
if principle <= 0:
print("Principle value can't be less than or equal to zero")
while rate <= 0:
rate = float(input("Enter the rate amount: "))
if rate <= 0:
print("Rate value can't be less than or equal to zero")
while time <= 0:
time = int(input("Enter the time amount: "))
if time <= 0:
print("Time value can't be less than or equal to zero")
#Formula
total = round(principle * pow((1 + rate / 100), time),2)
print(f"Principle Value is: {principle}")
print(f"Rate Value is: {rate}")
print(f"Time Value is: {time}")
print(f"Balance after {time} year/s: ${total:,.2f}")