Dear Scurvy,
    I don't know if this has been suggested yet, but I just broke the
larger list of 10 digit nums into segments, and at the end of the loop,
kept the previous last num in the segment as the beginning of the next
range() that goes through the same amount of ints in each segmentation of
the larger list to iterate through.

Except the next list of ints is starting where the last set segmentation of
possible length int segments ends, and keeps iterating through all possible
nums until it hits a match high_num.

The following goes through 10,000 element lists until it hits a target
high_num, which in this case is 1,000,000.



def iterToHighNum(increment,high_num):
    end_point = 0
    a = [i for i in range(0,increment)]
    while (end_point != high_num) == True:
        for integer in a:
            if integer != high_num:
                #print "no match, integer = %i" % (integer)
                end_point += 1
            if end_point == high_num and integer != (high_num - 1):
                print 'match, integer = %i, high_num = %i' %
(integer,high_num)

        previous_increment = increment
        increment += increment
        a = [i for i in range(previous_increment,increment)]

#instance
increment = 10000
high_num = 1000000
iterToHighNum(increment,high_num)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to