# q11 - DEBUG function
futureValue(principal,N,interestRate)
# - This function currently returns INCORRECT answers
# - Find and fix the errors in the function below
#
# - the program accepts 3 parameters:
# --- principal - float (starting amount)
# --- N - integer (number of years)
# --- interestRate - float (value less than 1)
#
# - futureValue should calculate the future value of the
principal
# when invested at the interestRate for N years. Interest is
# compounded at the end of each year.
#
# - Example:
# principal = 1000.00
# N = 3
# interestRate = .05 (this is 5%)
#
# The value at the end of each year is:
# N1: 1000.00 * 1.05 = 1050.00
# N2: 1050.00 * 1.05 = 1102.50
# N3: 1102.50 * 1.05 = 1157.625
#
# return 1157.625
In case of any query do comment. Please rate answer as well. Thanks
Code:
# q11 - DEBUG function
futureValue(principal,N,interestRate)
# - This function currently returns INCORRECT answers
# - Find and fix the errors in the function below
#
# - the program accepts 3 parameters:
# --- principal - float (starting amount)
# --- N - integer (number of years)
# --- interestRate - float (value less than 1)
#
# - futureValue should calculate the future value of the
principal
# when invested at the interestRate for N years. Interest is
# compounded at the end of each year.
#
# - Example:
# principal = 1000.00
# N = 3
# interestRate = .05 (this is 5%)
#
# The value at the end of each year is:
# N1: 1000.00 * 1.05 = 1050.00
# N2: 1050.00 * 1.05 = 1102.50
# N3: 1102.50 * 1.05 = 1157.625
#
# return 1157.625
def futureValue(principal,N,interestRate):
amount = principal
for i in range(N):
amount = amount + (amount * interestRate)
print("N{}: Amount: {}".format(i+1,amount))
return amount
#main driver function
amount = futureValue(1000,3,0.05)
print("Future Value: ", amount)
==========Screen shot of the code for indentation=======
Output:
# q11 - DEBUG function futureValue(principal,N,interestRate) # - This function currently returns INCORRECT answers # -...
please follow the instruction ( very important ) 1912275-dt content-rid 43901523 1/courses/CSct A31. (25 pts) You must use a tor loop in the following program Write, compile, debug, and run a program that will use a for loop to do the following Some investments compound interest. This means that the interest is added onto the balance periodically during the year, and the next interest is calculated on this larger balance. This makes the actual return on investment actually greater than...