On Fri, Nov 29, 2013 at 02:24:49PM -0500, spine...@aol.com wrote:
> Hi
> 
> 
> Newbie at this.  I am getting this error:   
> TypeError: range() integer end argument expected, got float.

Note carefully that the error here is with the range() function. In your 
code, you have:

> for payment in range(lowerbound, upperbound, 10):
>     if PaymentTable(balance, annualInterestRate, payment) == True:  ####Error 
> occurs at this line

You are mistaken about where the error occurs. It occurs on the 
*previous* line, the one that says "for payment in range...".

You have three arguments for range. All three need to be integers (whole 
numbers, like 0, 1, 2, ...) not floats (numbers with decimal points like 
2.5, 5.25, or even 7.0). Even if the fraction part is "point zero", 
Python will insist it is a float.

You have two solutions here: the best one is to go back to where you 
define lowerbound and upperbound and make sure they are whole numbers 
with no decimal point.

The less-good solution is to change the line to this:

for payment in range(int(lowerbound), int(upperbound), 10):



-- 
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to