Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

formula for compounding interest in python

P = int(input("Enter starting principle please. "))
n = int(input("Enter number of compounding periods per year. "))
r = float(input("Enter annual interest rate. e.g. 15 for 15% "))
y = int(input("Enter the amount of years. "))

FV = P * (((1 + ((r/100.0)/n)) ** (n*y)))

print ("The final amount after", y, "years is", FV)
Comment

compound interest python

def compound_interest(initial_amount, rate, periods_elapsed):
    return initial_amount * (1 + (rate/100))**periods_elapsed

# Example: 100 of money, 5 %, 12 months passed
print(compound_interest(100, 5, 12)) # -> 179.5856

# The formula:
# A = P(1 + r/100)^t
Comment

PREVIOUS NEXT
Code Example
Python :: doctest example in python 
Python :: python dict in dict 
Python :: django httpresponse 
Python :: python function parameters default value 
Python :: python check date between two dates 
Python :: matplotlib.pyplot 
Python :: cv2.videocapture python set frame rate 
Python :: discordpy make all inputs lowercase 
Python :: journalctl not showing all python prints 
Python :: displace items in array python 
Python :: compilation terminated. In file included from plugins/python/pyloader.c:1:0: plugins/python/uwsgi_python.h:2:10: fatal error: Python.h: No such file or directory #include <Python.h 
Python :: python select columns names from dataframe 
Python :: python calculated row in dataframe subtract 
Python :: python if index not out of range 
Python :: python status code to string 
Python :: series floor 
Python :: pd dataframe 
Python :: create database python 
Python :: pyhton dms to decimal 
Python :: python get object parameters 
Python :: python string ignore characters 
Python :: create django app 
Python :: been deprecated, please pass in a Service object 
Python :: convert numpy array to tfrecord and back 
Python :: zoom in librosa.display.specshow() 
Python :: Python .on event triggers 
Python :: how to iterate through a pandas dataframe 
Python :: position text in a box matplotlib 
Python :: viewset and router 
Python :: powershell bulk rename and add extra string to filename 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =