[BangPypers] Iterating list of tuples
venkat83 at gmail.com
Mon Jul 4 09:22:16 CEST 2011
On Mon, Jul 4, 2011 at 12:47 PM, Anand Balachandran Pillai <
abpillai at gmail.com> wrote:
> >>> data=[(10,25, 18, 17, 10, 12, 26, 5)]
> >>> for value in zip(*data):
> ... if (value > 5): print 'Greater'
> ... else: print 'Lesser'
Right. I wrote this and then didnt send as the OP sounds like a n00b.
Btw, i got a Q: why doesnt 'any' work in this case? Like...
for tup in data:
if any(tup) > 5:
More information about the BangPypers