Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 11:03 pm, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 21, 2012 at 1:23 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: Your variable names need a bit more thought def average(bin): What is a bin?

Re: can some one help me with my code. thanks

2012-01-23 Thread Tamanna Sultana
On Jan 20, 9:23 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great:

Re: can some one help me with my code. thanks

2012-01-22 Thread Vincent Vande Vyvre
Le 20/01/12 20:30, Vincent Vande Vyvre a crit: Le 20/01/12 19:49, Tamanna Sultana a crit: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the

can some one help me with my code. thanks

2012-01-20 Thread Tamanna Sultana
can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the above bin, since there are 4 sets of numbers separated by 4 'end' strings

Re: can some one help me with my code. thanks

2012-01-20 Thread Vincent Vande Vyvre
Le 20/01/12 19:49, Tamanna Sultana a crit: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the

Re: can some one help me with my code. thanks

2012-01-20 Thread Terry Reedy
On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages from the above bin, since there are 4 sets

Re: can some one help me with my code. thanks

2012-01-20 Thread Tim Chase
On 01/20/12 13:46, Terry Reedy wrote: def average(bin): num=[] total = 0.0 count=0 for number in bin: if number!='end': total += float(number) count+=1 else: num.append(total/count) total = 0.0

Re: can some one help me with my code. thanks

2012-01-20 Thread Terry Reedy
On 1/20/2012 2:46 PM, Terry Reedy wrote: On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the numbers separated by a string 'end'. I am expecting to have 4 averages

Re: can some one help me with my code. thanks

2012-01-20 Thread Rick Johnson
On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great: Your variable names need a bit more thought def average(bin): What is a bin? Maybe you shoulc have called this a lst eh?     num=[] Why

Re: can some one help me with my code. thanks

2012-01-20 Thread Jon Clements
On Jan 20, 9:26 pm, Terry Reedy tjre...@udel.edu wrote: On 1/20/2012 2:46 PM, Terry Reedy wrote: On 1/20/2012 1:49 PM, Tamanna Sultana wrote: can some one help me?? I would like to create a function that, given a bin, which is a list (example below), generates averages for the

Re: can some one help me with my code. thanks

2012-01-20 Thread Steven D'Aprano
On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: On Jan 20, 12:49 pm, Tamanna Sultana tamannas.rah...@gmail.com wrote: If you can give me some lead to fix the code I wrote below that will be great: Your variable names need a bit more thought def average(bin): What is a bin?

Re: can some one help me with my code. thanks

2012-01-20 Thread Chris Angelico
On Sat, Jan 21, 2012 at 1:23 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 20 Jan 2012 16:21:30 -0800, Rick Johnson wrote: Your variable names need a bit more thought def average(bin): What is a bin? Maybe you shoulc have called this a lst eh? Bin is a standard