True of False
Shriphani
shriphanip at gmail.com
Thu Sep 27 12:48:53 EDT 2007
kou... at hotmail.com 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?
> Thanks.
>
> Kou
Hello,
Just try :
a = ["a","b","c","d","e","f"]
if "c" in a:
print "yes"
That is going to work as the statement '"c" in a' itself is true. You
could try that by typing "c" in a at the interpreter.
regards,
Shriphani Palakodety
More information about the Python-list
mailing list