Python
Albert Einstein famously said that compound interest is the 8th wonder of the world. Hopefully, all of you have had a finance course to teach you why it is so much more powerful than simple interest, which we programmed in class. If you are unfamiliar with compound interest, google it (note - if you google "compound interest for dummies" you will get a MUCH simpler explanation of how it works, without greek function notations!!)
Your assignment this week is to use a for loop, with the range() function to figure out compound interest on a deposit. You will ask the user for the amount of the deposit, the interest rate and the number of years and tell her how much money she has after that amount of time. Be sure to use the isnumeric function, and do NOT use an exponent to figure out compound interest - use a loop! I know this question was already answered but I want a different way of doing it if there is possible so I don't have the same answer.
principal = input("Enter Amount Of Deposit: ")
intrestRate =input("Enter Interest Rate: ")
years =input("Enter No of Years: ")
if(principal.isnumeric() and intrestRate.isnumeric() and years.isnumeric()):
for year in range(1,int(years)+1):
intrestamount=(float(principal)*float(intrestRate))/100
principal=float(principal)+float(intrestamount)
print("After "+str(years)+" Years the total amount including interest is "+str(principal))
else:
print("Invalid Input (Entered Values Are Not Numeric Values) Enter Numeric Values")
Get Answers For Free
Most questions answered within 1 hours.