Re: [Tutor] summing lists

2012-04-10 Thread Hs Hs
python.org" Sent: Tuesday, April 10, 2012 11:37 AM Subject: Re: [Tutor] summing lists > I have 4 lists: > > >>> a > [40] > >>> b > [2] > >>> c > [23] > >>> d > [12] > Why are you using lists with a single element, instead

Re: [Tutor] summing lists

2012-04-10 Thread Dave Angel
On 04/10/2012 11:28 AM, Hs Hs wrote: > sorry I did this following, please advise if any better way exist: > You top-posted, so we lose the context you were using. You never really say why you're using lists with exactly one element in them, but presuming that the real lists consist of something l

Re: [Tutor] summing lists

2012-04-10 Thread Evert Rol
> I have 4 lists: > > >>> a > [40] > >>> b > [2] > >>> c > [23] > >>> d > [12] > Why are you using lists with a single element, instead of single integer variables? (thus, a=40, b=2, c=23, d=12.) > how is it possible to do add elements in list. sum() > I can do this using tupples, but I do

Re: [Tutor] summing lists

2012-04-10 Thread James Reynolds
On Tue, Apr 10, 2012 at 11:22 AM, Hs Hs wrote: > Hi: > > I have 4 lists: > > >>> a > [40] > >>> b > [2] > >>> c > [23] > >>> d > [12] > > > how is it possible to do add elements in list. I can do this using > tupples, but I do not know how to append elements to tuple, thats the > reason I am usin

Re: [Tutor] summing lists

2012-04-10 Thread Hs Hs
sorry I did this following, please advise if any better way exist: gc = lambda x,y: x[0]+y[0] atgc = lambda x,y,k,l: x[0]+y[0]+k[0]+l[0] >>> gc(a,b)/atgc(a,b,c,d) 0.54545454545454541 Hi: I have 4 lists: >>> a [40] >>> b [2] >>> c [23] >>> d [12] how is it possible to do add eleme

[Tutor] summing lists

2012-04-10 Thread Hs Hs
Hi: I have 4 lists: >>> a [40] >>> b [2] >>> c [23] >>> d [12] how is it possible to do add elements in list. I can do this using tupples, but I do not know how to append elements to tuple, thats the reason I am using list.  I want to find the value of a+c/a+b+c+d - which is 40+23/40+2+23+12