Re: Test a list

2013-03-20 Thread John Gordon
In <121be20a-c02a-4b0e-a86f-7c69597b9...@googlegroups.com> =?ISO-8859-1?Q?Ana_Dion=EDsio?= writes: > t= [3,5,6,7,10,14,17,21] > Basically I want to print Test 1 when i is equal to an element of the > list "t" and print Test 2 when i is not equal: > while i<=25: > if i==t[]: >pri

Re: Test a list

2013-03-20 Thread Steven D'Aprano
On Wed, 20 Mar 2013 11:15:27 -0700, Ana Dionísio wrote: > t= [3,5,6,7,10,14,17,21] > > Basically I want to print Test 1 when i is equal to an element of the > list "t" and print Test 2 when i is not equal: Wouldn't it make more sense to print "Equal" and "Not equal"? If all you want to do is ch

Re: Test a list

2013-03-20 Thread Tim Chase
On 2013-03-20 11:15, Ana Dionísio wrote: > t= [3,5,6,7,10,14,17,21] > > Basically I want to print Test 1 when i is equal to an element of > the list "t" and print Test 2 when i is not equal: > > while i<=25: > if i==t[]: >print "Test1" > else: >print "Test2" > > What is m

Re: Test a list

2013-03-20 Thread Joel Goldstick
On Wed, Mar 20, 2013 at 2:15 PM, Ana Dionísio wrote: > > t= [3,5,6,7,10,14,17,21] > > Basically I want to print Test 1 when i is equal to an element of the list > "t" and print Test 2 when i is not equal: > > > while i<=25: > You test i, but you don't set i to anything, or change it in your loop

Re: Test a list

2013-03-20 Thread timothy crosley
Hi Ana, if I understand your question correctly, all you have to do to test this is to write: if i in t: print "Test1" else: print "Test2" On Wednesday, March 20, 2013 2:15:27 PM UTC-4, Ana Dionísio wrote: > t= [3,5,6,7,10,14,17,21] > > > > Basically I want to print Test 1 when i is e

Test a list

2013-03-20 Thread Ana Dionísio
t= [3,5,6,7,10,14,17,21] Basically I want to print Test 1 when i is equal to an element of the list "t" and print Test 2 when i is not equal: while i<=25: if i==t[]: print "Test1" else: print "Test2" What is missing here for this script work? Thank you all -- http: