Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread delegbede
I still can't see my mistake Kenneth. May I just point out that, I am quite unhappy with Venk's choice of word. Should there be a mistake in what I wrote, there surely wouldn't be an intention to misguide. Kindly point out the mistake please. Thank you. --Original Message-- From:

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread Kenneth Gonsalves
On Mon, 2011-07-04 at 06:37 +, delegb...@dudupay.com wrote: > > data = [ > (10, 25, 18, 17, 10, 12, 26, 5), > ] > > for value in data: > if value > 5: value = (10, 25, 18, 17, 10, 12, 26, 5) -- regards Kenneth Gonsalves http://lawgon.livejournal.com/ _

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread Venkatraman S
On Mon, Jul 4, 2011 at 12:07 PM, wrote: > > Your new code should read this. > > data = [ >(10, 25, 18, 17, 10, 12, 26, 5), >] > > for value in data: > if value > 5: > print " greater" >else: >print "lesser" > WRONG. Please dont misguide. _

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread delegbede
Asif, You can iterate over a tuple. When doing that you reference the values directly. >From your example, data is a list containing a tuple. To check this, do this >from the prompt. type(data) You should get: That said, your mistake is On the if line. It should read: if value > 5: And not

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread Venkatraman S
On Mon, Jul 4, 2011 at 11:54 AM, Asif Jamadar wrote: > Suppose I have list of tuples > > data = [ >(10, 25, 18, 17, 10, 12, 26, 5), >] > > for value in data: > if data[value]>5: >print " greater" >else: > print "lesser" > > But the code giving me error so can

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread Noufal Ibrahim
Asif Jamadar writes: > Suppose I have list of tuples > > data = [ > (10, 25, 18, 17, 10, 12, 26, 5), > ] > > for value in data: > if data[value]>5: > print " greater" > else: >print "lesser" if the list has just one tuple, you need to iterate over it's i

Re: [BangPypers] Iterating list of tuples

2011-07-03 Thread Anand Chitipothu
2011/7/4 Asif Jamadar : > Suppose I have list of tuples > > data = [ >    (10, 25, 18, 17, 10, 12, 26, 5), >    ] > > for value in data: >     if data[value]>5: >                print " greater" >    else: >       print "lesser" > > But the code giving me error so can I know how iterate list of tup

[BangPypers] Iterating list of tuples

2011-07-03 Thread Asif Jamadar
Suppose I have list of tuples data = [ (10, 25, 18, 17, 10, 12, 26, 5), ] for value in data: if data[value]>5: print " greater" else: print "lesser" But the code giving me error so can I know how iterate list of tuples? ___