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?
2011/7/4 Asif Jamadar asif.jama...@rezayat.net:
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
Asif Jamadar asif.jama...@rezayat.net 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
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:
Type 'list'
That said, your mistake is
On the if line. It should read:
if value
On Mon, Jul 4, 2011 at 12:07 PM, delegb...@dudupay.com 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.
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/
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--
On Mon, Jul 4, 2011 at 12:23 PM, delegb...@dudupay.com wrote:
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
On Mon, Jul 4, 2011 at 12:23 PM, delegb...@dudupay.com wrote:
I still can't see my mistake Kenneth.
May I just point out that, I am quite unhappy with Venk's choice of word.
I would have apologized if you had tried the code that you had written or
atleast mentioned in the email
that 'i
On Mon, Jul 4, 2011 at 12:01 PM, Noufal Ibrahim nou...@gmail.com wrote:
Asif Jamadar asif.jama...@rezayat.net 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
delegb...@dudupay.com writes:
Venkatraman,
You sound quite rude and arrogant.
Maybe but these *are* public lists and you'll find all sorts of people
here.
Venkat's mail was to the point but lacked sugar coating and (in poor
taste) contained an accusation.
I think you should just let it
On Mon, Jul 4, 2011 at 1:01 PM, Noufal Ibrahim nou...@gmail.com wrote:
Right. I wrote this and then didnt send as the OP sounds like a n00b.
n00b (especially with the leet speak) is a tad pejorative. I think you
should not use the word here.
I apologize captain! :)
for i in data[0]: # Iterate over elements of the tuple
if i 5:
print greater
else:
print lesser
`value` in your code does not mean the index, it's the actual element
itself.
It is unsaid rule that variables i, j and k are used
On Mon, Jul 4, 2011 at 12:53 PM, delegb...@dudupay.com wrote:
You sound quite rude and arrogant.
This is a public forum and you should manage your choice of words.
My error was a typo and I wouldn't have pushed what I haven't tried out.
What I didn't put was the index of the tuple in the
It's all good gentlemen.
I have learnt a great deal here and won't have a thing like this slow me down.
Sorry about the typo, I would pay more attention next time.
That said, thanks for your respective inputs.
It's morning here in Nigeria, so, good morning or good afternoon or good night.
On Mon, Jul 04, 2011 at 07:48:50PM +0200, Georg Brandl wrote:
On behalf of the Python development team, I am pleased to announce the
second release candidate of Python 3.2.1.
Python 3.2.1 will the first bugfix release for Python 3.2, fixing over 120
bugs and regressions in Python 3.2.
For
16 matches
Mail list logo