[Tutor] List all possible 10digit number
dwightdhutto at gmail.com
Sat Sep 1 07:20:38 CEST 2012
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.
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' %
previous_increment = increment
increment += increment
a = [i for i in range(previous_increment,increment)]
increment = 10000
high_num = 1000000
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor