[Tutor] TypeError: range() integer end argument expected, got float.

spinefxr at aol.com spinefxr at aol.com
Fri Nov 29 20:24:49 CET 2013


Hi


Newbie at this.  I am getting this error:   
TypeError: range() integer end argument expected, got float.



Using python 7.3


here is my code



def PaymentTable(balance, annualInterestRate, payment):
    month = 0
    while month < 12:
        balance = balance - payment
        interest = balance * (annualInterestRate/12)
        balance = balance + interest
        month += 1
        
        if balance <= 0:
            return True
            
balance = 4773
annualInterestRate = .2
monthlyinterest = balance * (annualInterestRate/12)
lowerbound = round(balance / 12, 0)
upperbound = round((balance + (monthlyinterest * 12)) / 12, 0)


for payment in range(lowerbound, upperbound, 10):
    if PaymentTable(balance, annualInterestRate, payment) == True:  ####Error occurs at this line
        print 'Lowest Payment: ', payment
        break



Richard Roth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131129/702f37f8/attachment.html>


More information about the Tutor mailing list