0% found this document useful (0 votes)
6 views2 pages

Finance Calculator: Interest & EMI

Uploaded by

kbazmina2018
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Finance Calculator: Interest & EMI

Uploaded by

kbazmina2018
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import math

def simple_interest(principal, rate, time):

return (principal * rate * time) / 100

def compound_interest(principal, rate, time):

return principal * (pow((1 + rate/100), time)) - principal

def loan_emi(principal, rate, time):

monthly_rate = rate / (12 * 100)

months = time * 12

emi = (principal * monthly_rate * pow(1 + monthly_rate, months)) / (pow(1 +


monthly_rate, months) - 1)

return emi

def savings_growth(principal, monthly_deposit, rate, time):

months = time * 12

balance = principal

monthly_rate = rate / (12 * 100)

for _ in range(months):

balance = (balance + monthly_deposit) * (1 + monthly_rate)

return balance

while True:

print("\n===== Finance Calculator =====")

print("1. Simple Interest")

print("2. Compound Interest")

print("3. Exit")

choice = input("Enter your choice (1,2,3): ")

if choice == '1':

p = float(input("Enter Principal: "))

r = float(input("Enter Rate of Interest (%): "))


t = float(input("Enter Time (years): "))

print("Simple Interest =", simple_interest(p, r, t))

elif choice == '2':

p = float(input("Enter Principal: "))

r = float(input("Enter Rate of Interest (%): "))

t = float(input("Enter Time (years): "))

print("Compound Interest =", compound_interest(p, r, t))

elif choice == '3':

print("Exited Goodbye!")

break

else:

print("Invalid choice. Please try again.")

You might also like