65.6k views
4 votes
is given on Wikipedia as Here, P it (the amount that the interest is provided on), n the frequency that the interest is paid out (per year), and r the Write a program that replaces these letters with something a bit more human-readable, and calculate the interest for some varying amounts of money at realistic interest rates such as 1%, and -0.05%. When you have that working, ask the user for the value of some of these variables and do the calculation.

1 Answer

3 votes

Answer:

See Explaination

Step-by-step explanation:

def compound_interest(principal, roi, term, payout_frequency):

return principal * ((1 + (roi / payout_frequency)) ** (payout_frequency * term))

if __name__ == "__main__":

# get input from user

principal_amount = int(input("Enter principal amount: "))

rate_of_interest = float(input("Enter rate of interest: "))

term_in_years = int(input("Enter number of years: "))

interest_payout_frequency = int(input("Enter frequency of interest payout: "))

# call compound interest calculating function

final_amount = compound_interest(principal_amount,

rate_of_interest,

term_in_years,

interest_payout_frequency)

print("Final Amount: ", final_amount)

User Sachin Vishwakarma
by
4.0k points