Re: [Tutor] List all possible 10digit number

2012-09-01 Thread eryksun
On Sat, Sep 1, 2012 at 3:18 AM, Dave Angel wrote: > > Somehow i missed the point that xrange() is NOT necessarily limited to > Python int values. So it may be usable on your machine, if your Python > is 64bit. All I really know is that it works on mine (2.7 64bit, on > Linux). See the following qu

Re: [Tutor] List all possible 10digit number

2012-09-01 Thread Dave Angel
On 08/31/2012 09:08 PM, Scurvy Scott wrote: > First of all thank you guys for all your help. The manual is really no > substitute for having things explained in laymans terms as opposed to a > technical manual. > > My question is this- I've been trying for a month to generate a list of all > pos

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
I'm not sure what the point of any of that is; you're making a simple > problem complex. If you're wanting to accomplish the task without using > any of the itertools stuff, why not just: > > > current = 10**9 > lim = 10**10 > while current < lim: > print current #or write to file, or wha

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
I could comment this better. We have a function, iterToHighNum, that takes two parameters: increment and high_num. increment is how long the list of numbers being added to the old increment list of ints, to create a shorter int list that maintains the sequential count, looking for the high number

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 09/01/2012 01:46 AM, Dwight Hutto wrote: > Here's the better function fixed with a return statement I forgot, but > might not be as quick as the pre-built functions already shown: > > def iterToHighNum(increment,high_num): > end_point = 0 > a = [i for i in range(0,increment)] > while

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
Here's the better function fixed with a return statement I forgot, but might not be as quick as the pre-built functions already shown: 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

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
It might be a little buggy, but I'm in a rush, so it has a flaw in it. But I think you get the point I'm trying to make. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
I mean line 7. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
You can also watch this happen by uncommenting print on line 8: 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 matc

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread eryksun
On Sat, Sep 1, 2012 at 12:29 AM, Scurvy Scott wrote: > > The while loop works for simply printing. Now I'm trying to save to a file > > I = 10 > Boogers = raw_input("file") > Baseball = open(Boogers) As ASCII, that's 11 bytes per number times 9 billion numbers. That's approximately 92 GiB

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dwight Hutto
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

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 10:38 PM, Scurvy Scott wrote: > Now I've got > > A = 10 > I = raw_input("file name> ") > TheFile = open(I, 'w') > > TheFile.truncate > def allten(a): > while a < 99: > a = + 1 > TheFile.write(a) > allten(a) > > The result is: > Open file 'file.t

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 10:14 PM, Scurvy Scott wrote: > Thanks for the reply. This isn't an assignment per se as I'm just learning > python for my own sake- not in classes or school or what have you. As I said > I'm pretty new to python picking up whatever I can and generators are > something that I haven

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread eryksun
On Fri, Aug 31, 2012 at 9:08 PM, Scurvy Scott wrote: > > My question is this- I've been trying for a month to generate a list of > all possible 10 digit numbers. I've googled, looked on stackoverflow, > experimented with itertools, In itertools, look at count() and islice(). An alternative to isl

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 09:08 PM, Scurvy Scott wrote: > First of all thank you guys for all your help. The manual is really no > substitute for having things explained in laymans terms as opposed to a > technical manual. > > My question is this- I've been trying for a month to generate a list of all > pos