Skip to content

Commit ed16499

Browse files
Update and rename test.md to fix.py
1 parent 61950f4 commit ed16499

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

fix.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# This script calculates yearly compound interest given principal, annual rate of interest and time period in years.
3+
# Do not use this in production. Sample purpose only.
4+
5+
# Author: Upkar Lidder (IBM)
6+
7+
# Input:
8+
# p, principal amount
9+
# t, time period in years
10+
# r, annual rate of interest
11+
12+
# Output:
13+
# compound interest = p * (1 + r/100)^t
14+
15+
16+
def compound_interest(p, t, r):
17+
return p * (pow((1 + r / 100), t))
18+
19+
20+
if __name__ == "__main__":
21+
p = float(input("Enter the principal amount: "))
22+
t = float(input("Enter the time period: "))
23+
r = float(input("Enter the rate of interest: "))
24+
25+
print("The compound interest is {:.2f}".format(compound_interest(p, t, r)))
26+

test.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)