> I loop through each list and check if list[0] is in > range of previous list list[1] AND if it is less or > greater than. If less, I retain the greater number and > loop through. ... > example are small, it worked. in the real world > example , it did not work, because computer slowed > down and eventually crashed. The range(81393417) is > really big.
Rather than use 'in' just compare against the limits. if num in range(min, max): becomes if min < num < max: The first version has to construct a list size max then it has to cycle through the list comparing every entry with num. Because its a contiguous range you only want to compare with the bottom and top, which is much faster. HTH, Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor