Re: [Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
Thanks Kent, I liked the generator solution (I knew there had to be something like that). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: 09 May 2006 17:54 Cc: tutor@python.org Subject: Re: [Tutor] Summing part of a list <<

Re: [Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
2 passes of the original list). Surely there is a neater way. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Webber Sent: 09 May 2006 17:22 To: tutor@python.org Subject: [Tutor] Summing part of a list I have a list that looks a bit like this -

Re: [Tutor] Summing part of a list

2006-05-09 Thread Bob Gailer
Matthew Webber wrote: > I have a list that looks a bit like this - > > [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), > (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), > (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] > > The list items are tuples

Re: [Tutor] Summing part of a list

2006-05-09 Thread Kent Johnson
Matthew Webber wrote: > I have a list that looks a bit like this - > > [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), > (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), > (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] > > The list items are tuple

[Tutor] Summing part of a list

2006-05-09 Thread Matthew Webber
I have a list that looks a bit like this - [(u'gbr', 30505), (u'fra', 476), (u'ita', 364), (u'ger', 299), (u'fin', 6), (u'ven', 6), (u'chi', 3), (u'hun', 3), (u'mar', 3), (u'lux', 2), (u'smo', 2), (u'tch', 2), (u'aho', 1), (u'ber', 1)] The list items are tuples, the first item of which is a coun