#Calculates Annual Compound Interest print("Annual Compound Interest" #Accept input variables from user #Store the answers as floats principle = float(input("What is your starting principle investment? ")) annual_rate = float(input("What is your annual interest rate? ")) compound = float(input("How many times will your interest compound per year? ")) years = float(input("How many years will your money be invested? ")) #Calculate Interest interest = principle * ((1 + (annual_rate / compound)) ** (compound * years)) #Print Result print("The compound interest for %/s years is: ", interest) % (years)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question