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 :: pyspark create empty dataframe 
Python :: kivymd simple button 
Python :: how to convert kg to g using python 
Python :: python minute from datetime 
Python :: dataframe deep copy 
Python :: how to get a list of all values in a column df 
Python :: wait for element to be visible selenium python 
Python :: python display object attributes 
Python :: find elements by class name selenium python 
Python :: redirect to the same page django 
Python :: how to make text bold in tkinter 
Python :: python print version python 
Python :: selenium current url 
Python :: use python3 as default mac 
Python :: extract only year from date python 
Python :: stop server django programmatically 
Python :: python how to get script directory 
Python :: python roll a die 
Python :: extract text from a pdf python 
Python :: python add current directory to import path 
Python :: split list into list of lists python on every n element 
Python :: django sum get 0 if none 
Python :: get all columns names starting with pandas 
Python :: print terminal url 
Python :: how to replace nan with 0 in pandas 
Python :: decode base64 python 
Python :: replace nan in pandas 
Python :: taking string input from user in python 
Python :: resample and replace with mean in python 
Python :: requirements.txt flask 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =