Re: [Tutor] Compound if statement question.

2011-05-01 Thread Steven D'Aprano
Greg Christian wrote: Is there a way to write an if statement that will pick up duplicates (two ‘1’s): L = ['1', '4', '1'] if (L[0]) != (L[1]) != (L[2]): print "THEY ARE NOT EQUAL" else: print "THEY ARE EQUAL" When I run this code, it prints “THEY ARE NOT EQUAL” when it should print the

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Joel Goldstick
On Sun, May 1, 2011 at 2:28 PM, Greg Christian wrote: > Is there a way to write an if statement that will pick up duplicates > (two ‘1’s): > > L = ['1', '4', '1'] > if (L[0]) != (L[1]) != (L[2]): > print "THEY ARE NOT EQUAL" > else: > print "THEY ARE EQUAL" > > When I run this code, it p

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/01/2011 02:28 PM, Greg Christian wrote: > Is there a way to write an if statement that will pick up duplicates (two > ‘1’s): > > L = ['1', '4', '1'] > if (L[0]) != (L[1]) != (L[2]): > print "THEY ARE NOT EQUAL" > else: > print "THEY ARE

[Tutor] Compound if statement question.

2011-05-01 Thread Greg Christian
Is there a way to write an if statement that will pick up duplicates (two ‘1’s): L = ['1', '4', '1'] if (L[0]) != (L[1]) != (L[2]): print "THEY ARE NOT EQUAL" else: print "THEY ARE EQUAL" When I run this code, it prints “THEY ARE NOT EQUAL” when it should print the else “THEY ARE EQUAL”.