On 2/14/07, Steve <[EMAIL PROTECTED]> wrote: > After re-reading my original post I was pretty vague. I'm trying to creat > a list of ranges of floats, 0.0 10.0, 11 20, etc then checking to see if > an float, example 12.5 falls in the list and if so get the list index of > where it is in the index. Does this make sense?
Ah, you want to know if a certain number is between to other numbers. That's not what range() is for - range() is for generating lists of integers. You can use it to do a between test for integers, I suppose, but even for integers it's a pretty poor way of going about it - you'll be creating a potentially large lists of integers, only to throw it away again. Consider something like: def between(lower, upper, target): return lower < target < upper Works for integers and floats interchangably. Or better still, do the lower < target < upper thing inline. -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list