On Thu, 27 Sep 2007 09:33:34 -0700, koutoo wrote: > I tried writing a true and false If statement and didn't get > anything? I read some previous posts, but I must be missing > something. I just tried something easy: > > a = ["a", "b", "c", "d", "e", "f"] > > if "c" in a == True: > Print "Yes" > > When I run this, it runs, but nothing prints. What am I doing wrong?
Wow that's odd: In [265]: a = list('abcdef') In [266]: a Out[266]: ['a', 'b', 'c', 'd', 'e', 'f'] In [267]: 'c' in a Out[267]: True In [268]: 'c' in a == True Out[268]: False In [269]: ('c' in a) == True Out[269]: True In [270]: 'c' in (a == True) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/bj/<ipython console> in <module>() <type 'exceptions.TypeError'>: argument of type 'bool' is not iterable What's going on there? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list