Re: Help with cumulative sum

2009-09-11 Thread Giacomo Boffi
Maggie writes: > [...] > else: >print 'The loop is finito' do you know of it.comp.lang.python? -- Sarebbe essere un atto di pieta'. Contro i miei principi.-- whip, in IFMdI -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with cumulative sum

2009-09-10 Thread Andreas Waldenburger
On Thu, 10 Sep 2009 17:48:32 +0200 Giacomo Boffi wrote: > Maggie writes: > > > [...] > > else: > >print 'The loop is finito' > > do you know of it.comp.lang.python? > Neat! They use computers in IT now? *flees, snickering* /W -- INVALID? DE! -- http://mail.python.org/mailman/listinf

Re: Help with cumulative sum

2009-09-10 Thread Steven D'Aprano
On Thu, 10 Sep 2009 09:55:29 +0200, Bruno Desthuilliers wrote: > Maggie a écrit : > > (snip - lots of answers and sensible suggestions already) > >>tmp_string = str(count) + ' ' + item > > Mays I suggest you learn about string formatting ? Which is generally good advice, but for a o

Re: Help with cumulative sum

2009-09-10 Thread Bruno Desthuilliers
Maggie a écrit : (snip - lots of answers and sensible suggestions already) tmp_string = str(count) + ' ' + item Mays I suggest you learn about string formatting ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with cumulative sum

2009-09-08 Thread Andreas Waldenburger
On Tue, 8 Sep 2009 12:49:23 -0700 (PDT) Maggie wrote: > On Sep 8, 3:29 pm, Maggie wrote: > > Building on the code that I posted in one of the previous posts.. I > > need to find a cumulative sum of the file of the times in the test > > file: > > > > here is the code i have: > > > > #!/usr/bin/py

Re: Help with cumulative sum

2009-09-08 Thread MRAB
Maggie wrote: On Sep 8, 4:17 pm, MRAB wrote: Maggie wrote: On Sep 8, 3:29 pm, Maggie wrote: Building on the code that I posted in one of the previous posts.. I need to find a cumulative sum of the file of the times in the test file: here is the code i have: #!/usr/bin/python import os.path #

Re: Help with cumulative sum

2009-09-08 Thread Maggie
On Sep 8, 4:17 pm, MRAB wrote: > Maggie wrote: > > On Sep 8, 3:29 pm, Maggie wrote: > >> Building on the code that I posted in one of the previous posts.. I > >> need to find a cumulative sum of the file of the times in the test > >> file: > > >> here is the code i have: > > >> #!/usr/bin/python

Re: Help with cumulative sum

2009-09-08 Thread Andreas Waldenburger
On Tue, 8 Sep 2009 13:23:43 -0700 (PDT) Maggie wrote: > On Sep 8, 4:17 pm, MRAB wrote: > [snip] > I saw my mistake...now it is telling me the following -- > > Traceback (most recent call last): > File "formisano_count.py", line 22, in > running_sum = running_sum + (int(item) * int(item)

Re: Help with cumulative sum

2009-09-08 Thread MRAB
Maggie wrote: On Sep 8, 3:29 pm, Maggie wrote: Building on the code that I posted in one of the previous posts.. I need to find a cumulative sum of the file of the times in the test file: here is the code i have: #!/usr/bin/python import os.path #name of output file filename = "OUTPUT.txt"

Re: Help with cumulative sum

2009-09-08 Thread Maggie
On Sep 8, 4:05 pm, "J. Cliff Dyer" wrote: > If I gave you a list of numbers, could you come up with a summifier > function that returns another list of numbers that are a cumulative sum? > You've got the information in place to create a file > > def summifier(nums): >     """Returns a list of numb

Re: Help with cumulative sum

2009-09-08 Thread J. Cliff Dyer
If I gave you a list of numbers, could you come up with a summifier function that returns another list of numbers that are a cumulative sum? You've got the information in place to create a file def summifier(nums): """Returns a list of numbers that are the running sum totals of nums"""

Re: Help with cumulative sum

2009-09-08 Thread Maggie
On Sep 8, 3:49 pm, Maggie wrote: > On Sep 8, 3:29 pm, Maggie wrote: > > > > > Building on the code that I posted in one of the previous posts.. I > > need to find a cumulative sum of the file of the times in the test > > file: > > > here is the code i have: > > > #!/usr/bin/python > > > import os

Re: Help with cumulative sum

2009-09-08 Thread Maggie
On Sep 8, 3:29 pm, Maggie wrote: > Building on the code that I posted in one of the previous posts.. I > need to find a cumulative sum of the file of the times in the test > file: > > here is the code i have: > > #!/usr/bin/python > > import os.path > > #name of output file > filename = "OUTPUT.tx

Help with cumulative sum

2009-09-08 Thread Maggie
Building on the code that I posted in one of the previous posts.. I need to find a cumulative sum of the file of the times in the test file: here is the code i have: #!/usr/bin/python import os.path #name of output file filename = "OUTPUT.txt" #open the file test = open ("test.txt", "rU") #re