Question

In: Computer Science

Python Albert Einstein famously said that compound interest is the 8th wonder of the world. Hopefully,...

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!

Solutions

Expert Solution

Python Code :

# Python code to Calculate the compound interest

# take all variable(principle amount, rate and years) till
# user input numerical value
n = ""
while not n.isnumeric():
    n=input("Enter the principle amount:")
n = float(n)

rate =""
while not rate.isnumeric():
    rate=input("Enter the rate:")
rate = float(rate)

years = ""
while not years.isnumeric():
    years=input("Enter the number of years:")
years = int(years)

# calculate final amount after each year
for i in range(years):
    n=n+((n*rate)/100)

print(n)

Output :

Enter the principle amount:  100
Enter the rate:  2
Enter the number of years: 2
104.04

Hope you like it

Any Query? Comment Down!

I have written for you, Please upvote the answer as it encourage us to serve you Best !


Related Solutions

Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands...
Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands it, earns it. He who doesn’t, pays it.” Regardless of whether Einstein uttered these exact words, the essence of his statement is still immensely powerful and cannot be disputed. For anyone who wants to build lasting wealth, understanding and harnessing the power of compound interest is essential. For the more visual of you, imagine, if you will, building the bottom part of a snowman....
Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands...
Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands it, earns it. He who doesn’t, pays it.” Regardless of whether Einstein uttered these exact words, the essence of his statement is still immensely powerful and cannot be disputed. For anyone who wants to build lasting wealth, understanding and harnessing the power of compound interest is essential. For the more visual of you, imagine, if you will, building the bottom part of a snowman....
Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands...
Albert Einstein reportedly said, “Compound interest is the eighth wonder of the world. He who understands it, earns it. He who doesn’t, pays it.” Regardless of whether Einstein uttered these exact words, the essence of his statement is still immensely powerful and cannot be disputed. For anyone who wants to build lasting wealth, understanding and harnessing the power of compound interest is essential. For the more visual of you, imagine, if you will, building the bottom part of a snowman....
World religion 3. Referring to Gandhi, Albert Einstein said: "Generations to come, it may be, will...
World religion 3. Referring to Gandhi, Albert Einstein said: "Generations to come, it may be, will scarcely believe that such a one as this in flesh and blood walked upon this earth." Do you agree? 4. Gandhi claimed that his power came from a love of truth as revealed in the Upanishads and the Bhagavad-Gita. Does this make sense to you? How was it revealed in Gandhi's life? 5. At the turn of the millennium, the names of many candidates...
Explain the importance of Albert Einstein and Mahatma Gandhi in modern world history? 500 word
Explain the importance of Albert Einstein and Mahatma Gandhi in modern world history? 500 word
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT