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:
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/
_
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.
_
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
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
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
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
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?
___