[Tutor] trouble with function-- trying to check differences btwn 2 strings

Terry Carroll carroll at tjc.com
Tue Mar 13 21:01:48 CET 2007


On Tue, 6 Mar 2007, Alan Gauld wrote:

> But I've been up since 4:30am and am too tired to try 
> figuring it out just now, so maybe someone else will 
> explain! :-)
> 
> >>> for c in 'abcd':
> ...    print (c == c in 'crab')
> ...
> True
> True
> True
> False

Trying to understand that, I tried this, which left me even more 
confused:

>>> for c in "abcd":
...    print (c == c in "crab"), (c == (c in "crab"))
...
True False
True False
True False
False False



More information about the Tutor mailing list