add results of a for loop after each iteration in Python - python

I am starting to learn coding and beginning with Python. In my Python course I have a problem that is the following:
Write a program to calculate the credit card balance after one year if
a person only pays the minimum monthly payment required by the credit
card company each month.
The following variables contain values as described below:
balance - the outstanding balance on the credit card
annualInterestRate - annual interest rate as a decimal
monthlyPaymentRate - minimum monthly payment rate as a decimal
For each month, calculate statements on the monthly payment and
remaining balance, and print to screen something of the format:
Month: 1
Minimum monthly payment: 96.0
Remaining balance: 4784.0
(I've got that part alright)
Finally, print out the total amount paid that year and the remaining balance at the end of the year in the format:
Total paid: 96.0
Remaining balance: 4784.0
(It is the part of total paid that I can't resolve after many hours of trying and searching)
So here is what I need to do: add up together all the results of minimum monthly payment to get the total that was paid.
Here is my code:
def creditPayment(balance, annuelInterestRate, monthlyPaymentRate):
for month in range(1, 13):
monthlyInterestRate = annuelInterestRate/ 12.0
minimumMonthlyPayment = monthlyPaymentRate * balance
monthlyUnpaidBalance = balance - minimumMonthlyPayment
balance = monthlyUnpaidBalance + (monthlyInterestRate * monthlyUnpaidBalance)
totalPaid = sum((minimumMonthlyPayment) for _ in range(0, 13))
print 'Month: ', month
print 'Minimum monthly payment: ', round(minimumMonthlyPayment, 2)
print 'Remaining balance: ', round(balance, 2)
print ' '
print 'Total paid: ', round(totalPaid, 2)
print 'Remaining balance: ', round(balance, 2)
print creditPayment(4213, 0.2, 0.04)
Everything works fine except for the total paid that adds up 12 times only the first value of minimumMonthlyPayment. I can't make it better.

If I've correctly interpreted your question, I'm assuming that your intent is to increment totalPaid by the minimumMonthlyPayment for each month. If so:
totalPaid = 0.0
for month in range(1, 13):
#
# Other stuff you're doing in the loop
#
totalPaid += minimumMonthlyPayment
Each time through the loop, totalPaid gets incremented by the minimum payment computed for that particular month. This logic of course has to be changed/augmented if you intend to add cases in which anything other than the minimum payment is paid.

In your for loop, you have:
totalPaid = sum((minimumMonthlyPayment) for _ in range(0, 13))
This is setting totalPaid to be 13 times the minimumMonthlyPayment, as it is for that iteration of the loop, so on the last loop the value is set to 13 times the last minimum payment. You need to add one value to the totalPaid each iteration, so that the value is updated before it is added. Here is what I would change the code to:
def creditPayment(balance, annuelInterestRate, monthlyPaymentRate):
totalPaid = 0
for month in range(1, 13):
monthlyInterestRate = annuelInterestRate/ 12.0
minimumMonthlyPayment = monthlyPaymentRate * balance
monthlyUnpaidBalance = balance - minimumMonthlyPayment
balance = monthlyUnpaidBalance + (monthlyInterestRate * monthlyUnpaidBalance)
totalPaid +=minimumMonthlyPayment
print 'Month: ', month
print 'Minimum monthly payment: ', round(minimumMonthlyPayment, 2)
print 'Remaining balance: ', round(balance, 2)
print ' '
print 'Total paid: ', round(totalPaid, 2)
print 'Remaining balance: ', round(balance, 2)
print creditPayment(4213, 0.2, 0.04)
print creditPayment(4213, 0.2, 0.04)
Also, since you aren't using the actual value of your iterator in for _ in range(0, 13), it would be more readable to just use range(13). I suspect you may have meant to have it loop 12 times, since the rest of your program does.

Related

Nested Loops calculation output is incorrect, but program runs

How am I able to get my program to display year 1 for the first 12 months and then year 2 for the next 12 months if the input value for years = 2?
Also I don't know where my calculation is going wrong. According to my desired output, the total rainfall output should be 37, but I am getting 39.
#the following are the values for input:
#year 1 month 1 THROUGH year 1 month 11 = 1
#year 1 month 12 THROUGH year 2 month 12 = 2
def main():
#desired year = 2
years = int(input("Enter the number of years you want the rainfall calculator to determine: "))
calcRainFall(years)
def calcRainFall(yearsF):
months = 12
grandTotal = 0.0
for years_rain in range(yearsF):
total= 0.0
for month in range(months):
print('Enter the number of inches of rainfall for year 1 month', month + 1, end='')
rain = int(input(': '))
total += rain
grandTotal += total
#This is not giving me the total I need. output should be 37.
#rainTotal = rain + grandTotal
#print("The total amount of inches of rainfall for 2 year(s), is", rainTotal)
print("The total amount of inches of rainfall for 2 year(s), is", grandTotal)
main()
Before the print statement, you don't need to add rain value again for rainTotal. This is because grandTotal accounts for the rain per year. And it is being added twice for two years already. So what you're doing is essentially adding the last value of rain twice (2 in this case)
Make your print statement this and remove rainTotal -
print("The total amount of inches of rainfall for 2 year(s), is", grandTotal)
I've shortened your code a little bit. Hopefully this is a complete and correct program:
def main():
years = int(input("Enter the number of years you want the rainfall calculator to determine: "))
calcRainFall(years)
def calcRainFall(yearsF):
months = 12 * yearsF # total number of months
grandTotal = 0.0 # inches of rain
for month in range(months):
# int(month / 12): rounds down to the nearest integer. Add 1 to start from year 1, not year 0.
# month % 12: finds the remainder when divided by 12. Add 1 to start from month 1, not month 0.
print('Enter the number of inches of rainfall for year', int(month / 12) + 1, 'month', month % 12 + 1, end='')
rain = int(input(': '))
grandTotal += rain
print("The total amount of inches of rainfall for", yearsF, "year(s), is", grandTotal)
main()
rainTotal = rain + grandTotal
is performing following: 2 + 37 because you have last rain input = 2 and already total or grandTotal is = 37 (total input for each year) so rainTotal = rain + grandTotal is not needed
Notes for your code:
As stated earlier, rainTotal is unneeded.
You can try:
print 'Enter the number of inches of rainfall for year %d month %d' % (years_rain, month), end='')
This will fill the first %d for the value for years_rain and the second %d with the value for month as your for loops run.
This trick can also be used on the final print line as shown below:
print("The total amount of inches of rainfall for %d year(s) % yearsF, is", grandTotal)

MITx: 6.00.1x Introduction to Computer Science and Programming Using Python

So I'm very new to Python... The problem is as follows:
Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.
My current code is as follows:
month = 1
minimumMonthlyPayment = (balance * monthlyPaymentRate)
totalPaid = 0.0
while month < 13:
print "Month: " + str(month)
print "Minimum Monthly Payment: " + str(round(minimumMonthlyPayment, 2))
balance = (balance - (balance * monthlyPaymentRate)) * (1 + (annualInterestRate/12))
minimumMonthlyPayment = (balance * monthlyPaymentRate)
print "Remaining Balance: " + str(round(balance, 2))
totalPaid += minimumMonthlyPayment
month += 1
print "Total Paid: " + str(round(totalPaid, 2))
print "Remaining Balance: " + str(round(balance, 2))
Here's the correct output:
So all the numbers are identical in both outputs but my Total Paid ends up being 1732.94 instead of the correct amount which is 1775.55. I added the numbers from my output up on a side calculator and it came out to 1775.55 as well. Is there something in my code that's borking this?
Here are the values for the variables that the test code uses:
balance = 4213;
annualInterestRate = 0.2;
monthlyPaymentRate = 0.04;
Great job! Your code is almost perfect. The only mistake is that line 8 needs to run before line 9. You're changing the balance and then using that changed balance to calculate the minimum monthly payment. You need to calculate the minimum monthly payment for each month before you update the balance.
Hope this helps!
balance = 4213
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
totalPaid = 0.0
month = 1
minimumMonthlyPayment = balance * monthlyPaymentRate
while month < 13:
print "Month: " + str(month)
print "Minimum Monthly Payment: " + str(round(minimumMonthlyPayment, 2))
minimumMonthlyPayment = balance * monthlyPaymentRate
balance = (balance - (balance*monthlyPaymentRate))*(1+(annualInterestRate/12))
print "Remaining Balance: " + str(round(balance, 2))
totalPaid += minimumMonthlyPayment
month += 1
print "Total Paid: " + str(round(totalPaid, 2))
print "Remaining Balance: " + str(round(balance, 2))
You are recalculating your balance before calculating your minimumMonthlyPayment rate.
So balance * monthlyPaymentRate comes to a different amount on line 8 and 9 since balance has changed.
If you assign balance * monthlyPaymentRate to a variable before those lines and use it for both calculations it would correct this.

algorithm that calculates a minimum amount to be paid to pay off a balance in 12 months

I'm struggling with a problem that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment, I mean a single number which does not change each month, but instead is a constant amount, multiple of 10 and the same for all months, that will be paid each month. ( it is possible for the balance to become negative using this payment scheme, which is OK)
So as input I have
original_balance = 3329
annualInterestRate = 0.2
From this I'm calculating the followings :
after_12_months_interest = original_balance
monthlyInterestRate = round(annualInterestRate/12.0,2)
monthly_payment = 10
total_paid = 0
for i in range(0,12):
after_12_months_interest = after_12_months_interest + (annualInterestRate/12.0)*after_12_months_interest
while total_paid < after_12_months_interest:
new_balance = 0
unpaid_balance = original_balance - monthly_payment
total_paid = 0
for i in range(0, 13):
total_paid = total_paid + monthly_payment
if total_paid < after_12_months_interest:
monthly_payment = monthly_payment + 10
print "Lowest Payment: ", monthly_payment
My problem I have is that I end up having a monthly_payment just a little more than I should have it. In this case the return for the monthly_payment is 320 instead of 310. For all use cases I've tried the monthly_payment it's slightly more than it should be.
Anyone can give me a hint or an idea on what I'm doing wrong please. Thank you
Mandatory one-liner
from itertools import count
print(next(payment for payment in count(0, 10)
if sum(payment*(1+monthly)**i for i in range(12)) > original_balance*(1+annual)))
What this does:
next takes the first element of an iterator.
count tries values from 0 to infinity (only each time next is called, and only until a value is returned)
sum(payment*(1+monthly)**i for i in range(12)) That's the combined value of the payments. Each payment is worth itself plus all the saved interests (the earlier you repay, the less interest you'll owe later)
original_balance*(1+annual) is indeed the total value if nothing is repayed.
Alternative
print(next(payment for payment in count(0, 10)
if reduce(lambda x,_:(x - payment)*(1+monthly), range(12), original_balance) <= 0))
This one computes the combined remainder of the debt by reduceing the original_balance 12 times.

Calculate a running total during a for loop - Python

Edit: Below is my working code based on the feedback/answers I recieved.
This question stems from my previous question that came up while learning Python/CS using open courseware from MIT. --See my previous question here--
I am using the following code to make a list of month payments and other things. However at the end of the loop I need to give a running total for the total amount that has been paid of the months.
Original Code
balance = float(raw_input("Outstanding Balance: "))
interestRate = float(raw_input("Interest Rate: "))
minPayRate = float(raw_input("Minimum Monthly Payment Rate: "))
for month in xrange(1, 12+1):
interestPaid = round(interestRate / 12.0 * balance, 2)
minPayment = round(minPayRate * balance, 2)
principalPaid = round(minPayment - interestPaid, 2)
remainingBalance = round(balance - principalPaid, 2)
print 'Month: %d' % (month,)
print 'Minimum monthly payment: %.2f' % (minPayment,)
print 'Principle paid: %.2f' % (principalPaid,)
print 'Remaining balance: %.2f' % (remainingBalance,)
balance = remainingBalance
if month in xrange(12, 12+1):
print 'RESULTS'
print 'Total amount paid: '
print 'Remaining balance: %.2f' % (remainingBalance,)
The problem is that I have not been able to figure out how to keep a running total of the amounts paid. I tried adding totalPaid = round(interestPaid + principalPaid, 2) but that just led to a total for a single month, I cant seem to get it to keep that value for each month and then add them all up at the end to be printed out.
Also I know that the resulting amount should be 1131.12
I have found many examples of doing this when each value is know, via a list, but I cant seem to extrapolate that correctly.
Fixed Code
balance = float(raw_input("Outstanding Balance: "))
interestRate = float(raw_input("Interest Rate: "))
minPayRate = float(raw_input("Minimum Monthly Payment Rate: "))
totalPaid = 0
for month in xrange(1, 12+1):
interestPaid = round(interestRate / 12.0 * balance, 2)
minPayment = round(minPayRate * balance, 2)
principalPaid = round(minPayment - interestPaid, 2)
remainingBalance = round(balance - principalPaid, 2)
totalPaid += round(minPayment, 2)
print 'Month: %d' % (month,)
print 'Minimum monthly payment: %.2f' % (minPayment,)
print 'Principle paid: %.2f' % (principalPaid,)
print 'Remaining balance: %.2f' % (remainingBalance,)
balance = remainingBalance
if month in xrange(12, 12+1):
print 'RESULTS'
print 'Total amount paid: %.2f' % (totalPaid,)
print 'Remaining balance: %.2f' % (remainingBalance,)
Before your loop, initialize a variable to accumulate value:
total_paid = 0
And then, in the body of your loop, add the appropriate amount to it. You can use the += operator to add to an existing variable, e.g.
total_paid += 1
is a short form for total_paid = total_paid + 1. You don't want to give total_paid a new value each iteration, rather you want to add to its existing value.
I'm not sure about the specifics of your problem, but this is the general form for accumulating a value as you loop.
You always make the minimum payment? Just use minPayment instead of figuring out that math again. Keep a running total, then print it out after the loop.
balance = float(raw_input("Outstanding Balance: "))
interestRate = float(raw_input("Interest Rate: "))
minPayRate = float(raw_input("Minimum Monthly Payment Rate: "))
paid = 0
for month in xrange(1, 12+1):
interestPaid = round(interestRate / 12.0 * balance, 2)
minPayment = round(minPayRate * balance, 2)
principalPaid = round(minPayment - interestPaid, 2)
remainingBalance = round(balance - principalPaid, 2)
paid += minPayment
print # Make the output easier to read.
print 'Month: %d' % (month,)
print 'Minimum monthly payment: %.2f' % (minPayment,)
print 'Principle paid: %.2f' % (principalPaid,)
print 'Remaining balance: %.2f' % (remainingBalance,)
balance = remainingBalance
print
print 'RESULTS'
print 'Total amount paid:', paid
print 'Remaining balance: %.2f' % (remainingBalance,)
Also notice that range has exactly one value, so you'd just check month == 12, but it's simply not necessary here.
This answer worked for me:
First, create the derived value:
df.loc[0, 'C'] = df.loc[0, 'D']
Then iterate through the remaining rows and fill the calculated values:
for i in range(1, len(df)):
df.loc[i, 'C'] = df.loc[i-1, 'C'] * df.loc[i, 'A'] + df.loc[i, 'B']
Index_Date
A
B
C
D
2015/01/31
10
10
10
10
2015/02/01
2
3
23
22
2015/02/02
10
60
290
280
You actually have to initialize totalPaid to 0 and then
totalPaid = round(interestPaid + principalPaid, 2) + totalPaid
Inside the loop. Your problem is that you're not accumulating the total, you're just setting a new one on each iteration.
sounds like you were close. The problem is that you were overwriting the total each time. Try something like this:
totalPaid = totalPaid + round(interestPaid + principalPaid, 2)

Python: smarter way to calculate loan payments

How to calculate the monthly fee on a loan?
Given is:
a: an amount to loan.
b: the loan period (number of months).
c: the interest rate p.a. (interests is calculated and added every month, 1/12 of the interest is added. So if the interest is on 12%, 1% interest is added every month).
d: the amount of money owed after the end of the period.
This problem is a bit different than the usual since, the goal is not to have the loan payed after the loan period has ended, but to still owe an amount that is given. I have been able to find an algorithm so solve the problem if I wanted to pay the entire amount, but it will of course not work for this problem where the goal is to end up owing a given amount rather than not owing anything.
I managed to make a solution to this problem by starting with an guess and then keep on improving that guess until it was close enough. I wondered however, if there is a better way to simply calculate this, rather than just guessing.
Edit: Here's how I'm doing it now.
def find_payment(start, end, months, interest):
difference = start
guess = int(start / months * interest)
while True:
total = start
for month in range(1, months + 1):
ascribe = total * interest / 12
total = total + ascribe - guess
difference = total - end
# See if the guess was good enough.
if abs(difference) > start * 0.001:
if difference < 0:
if abs(difference) < guess:
print "payment is %s" % guess
return evolution(start, guess, interest, months)
else:
mod = int(abs(difference) / start * guess)
if mod == 0:
mod = 1
guess -= mod
else:
mod = int(difference / start * guess)
if mod == 0:
mod = 1
guess += mod
else:
print "payment is %s" % guess
return evolution(start, guess, interest, months)
evolution is just a function that displays how the loan would look like payment for payment and interest for interest, summing up total amount of interest paid etc.
An example would be if I wanted to find out the monthly payments for a loan starting with $100k and ending at $50k with an interest of 8% and a duration of 70 months, calling
>>> find_payment(100000, 50000, 70, 0.08)
payment is 1363
In the above case I would end up owing 49935, and I went through the loop 5 times. The amount of times needed to go through the loop depends on how close I want to get to the amount and it varies a bit.
This is a basically a mortgage repayment calculation.
Assuming that start is greater than end, and that interest is between 0 and 1 (i.e. 0.1 for 10% interest)
First consider the part of the payment you want to pay off.
Principal = start - end
The monthly payment is given by:
pay_a = (interest / 12) / (1 - (1+interest/12) ^ (-months))) * Principal
You then need to consider the extra interest. Which is just equal to the remaining principal times the monthly interest
pay_b = interest / 12 * end
So the total payment is
payment = (interest / 12) * (1 / (1 - (1+interest/12) ^ (-months))) * Principal + end)
On the example you gave of
Start: 100000
End: 50000
Months: 70
Interest: 8%
pay_a = 896.20
pay_b = 333.33
Payment = 1229.54
When I tested these values in Excel, after 70 payments the remaing loan was 50,000. This is assuming you pay the interest on the notional before the payment is made each month.
Perhaps the easiest way to think about this is to split the loan in two parts, one part which is to be repaid in full and another part where you don't pay off anything. You have already computed the monthly fee for the first part.
You can keep paying the interest of every month; then, you will alway owe the same amont.
Owe_1 = a
Int_2 = Owe_1*(InterestRate/12)
Pay_2 = Int_2
Owe_2 = Owe_1 + Int_2 - Pay_2 # ==> Owe_1 + Int_2 - Int_2 = Owe_1
Int_3 = Owe_2*(InterestRate/12)
Pay_3 = Int_3
Owe_3 = Owe_2 + Int_3 - Pay_3 # ==> Owe_2 + Int_3 - Int_3 = Owe_2 = Owe_1
python code to calculate emi
class EMI_CALCULATOR(object):
# Data attributes
# Helps to calculate EMI
Loan_amount = None # assigning none values
Month_Payment = None # assigning none values
Interest_rate = None #assigning none values
Payment_period = None #assigning none values
def get_loan_amount(self):
#get the value of loan amount
self.Loan_amount = input("Enter The Loan amount(in rupees) :")
pass
def get_interest_rate(self):
# get the value of interest rate
self.Interest_rate = input("Enter The Interest rate(in percentage(%)) : ")
pass
def get_payment_period(self):
# get the payment period"
self.Payment_period = input("Enter The Payment period (in month): ")
pass
def calc_interest_rate(self):
# To calculate the interest rate"
self.get_interest_rate()
if self.Interest_rate > 1:
self.Interest_rate = (self.Interest_rate /100.0)
else:
print "You have not entered The interest rate correctly ,please try again "
pass
def calc_emi(self):
# To calculate the EMI"
try:
self.get_loan_amount() #input loan amount
self.get_payment_period() #input payment period
self.calc_interest_rate() #input interest rate and calculate the interest rate
except NameError:
print "You have not entered Loan amount (OR) payment period (OR) interest rate correctly,Please enter and try again. "
try:
self.Month_Payment = (self.Loan_amount*pow((self.Interest_rate/12)+1,
(self.Payment_period))*self.Interest_rate/12)/(pow(self.Interest_rate/12+1,
(self.Payment_period)) - 1)
except ZeroDivisionError:
print "ERROR!! ZERO DIVISION ERROR , Please enter The Interest rate correctly and Try again."
else:
print "Monthly Payment is : %r"%self.Month_Payment
pass
if __name__ == '__main__':# main method
Init = EMI_CALCULATOR() # creating instances
Init.calc_emi() #to calculate EMI
for more info visit : https://emilgeorgejames.wordpress.com/2015/07/29/python-emi-equated-monthly-installment-calculator/
This rather a detailed way but will give the whole payment as well
# Mortgage Loan that gives the balance and total payment per year
# Function that gives the monthly payment
def f1 (principle,annual_interest_rate,duration):
r = annual_interest_rate/1200
n = duration*12
a=principle*r*((1+r)**n)
b= (((1+r)**n)- 1)
if r > 0 :
MonthlyPayment = (a/b)
else :
MonthlyPayment = principle/n
return MonthlyPayment
# Function that gives the balance
def f2 (principle,annual_interest_rate,duration,number_of_payments):
r = annual_interest_rate/1200
n = duration*12
a= ((1+r)**n)
b= ((1+r)**number_of_payments)
c= (((1+r)**n)-1)
if r > 0 :
RemainingLoanBalance = principle*((a-b)/c)
else :
RemainingLoanBalance = principle*(1-(number_of_payments/n))
return RemainingLoanBalance
# Entering the required values
principle=float(input("Enter loan amount: "))
annual_interest_rate=float(input("Enter annual interest rate (percent): "))
duration=int(input("Enter loan duration in years: "))
# Output that returns all useful data needed
print ("LOAN AMOUNT:",principle,"INTEREST RATE (PERCENT):",annual_interest_rate)
print ("DURATION (YEARS):",duration,"MONTHLY PAYMENT:",int(f1(principle,annual_interest_rate,duration)))
k=duration+1
BALANCE=principle
total=0
for i in range (1,k):
TOTALPAYMENT= f1(BALANCE,annual_interest_rate,k-i)*12
total+= TOTALPAYMENT
BALANCE= f2(principle,annual_interest_rate,duration,12*i)
print("YEAR:",i,"BALANCE:",int(BALANCE),"TOTAL PAYMENT",int(total))
How about this?
def EMI_calc(principle, rate, time, frequency):
return (principle / ((1-((1+(rate/frequency))**(-1*(time*frequency))))/(rate/frequency)))
print("""
----- Welcome to EMI programe for Python -----
""")
print("\n You have chosen to know the EMI for Loan.\n")
input('\nTo Continue Press ENTER --- to ABORT Press ctrl+c > \n')
print("\nPlease Enter amount of Loan to be taken: >\n")
principle = int(input())
print("\nEnter rate of interst (%): >\n")
rate = float(input())/100
print("\nEnter Term (Years): >\n")
time = float(input())
print("\nPlease enter the frequency of installments) : >\n")
frequency = int(input())
EMI = round(EMI_calc(principle, rate, time, frequency),0)
print("""
---------------------------------------------------------------------
""")
print(f"""
The EMI for Loan of Rs.{principle};
at interest rate of {rate*100} % for {time} years;
would be: Rs.""", EMI)
print("""
---------------------------------------------------------------------
""")
Here is a code snippet using numpy functions. This shows you the payment, principal, interest, instalment and total_amount each month. Run it and see the output. You can also check the syntax for Excel "IPMT()" and "PPMT()" functions for more explanation of the arguments.
https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.pmt.html#numpy.pmt
import math
import numpy as np
rate = 0.08
start_amount = 100000.0
end_amount = 50000.0
diff_amount = start_amount - end_amount
# nr_years = 4
payment_frequency = int (12)
nr_months = 70 # = nr_years * payment_frequency
per_np = np.arange (nr_months) + 1 # +1 because index starts with 1 here
pay_b = rate / payment_frequency * end_amount
ipmt_np = np.ipmt (rate / payment_frequency, per_np, nr_months, diff_amount) - pay_b
ppmt_np = np.ppmt (rate / payment_frequency, per_np, nr_months, diff_amount)
for payment in per_np:
idx = payment - 1
principal = math.fabs (ppmt_np [idx])
start_amount = start_amount - principal
interest = math.fabs (ipmt_np [idx])
instalment = principal + interest
print payment, "\t", principal, "\t", interest, "\t\t", instalment, "\t\t", start_amount
print np.sum (ipmt_np)

Categories

Resources