<p dir="ltr"><br>
On 14 Jun 2013 10:59, "Nick the Gr33k" <<a href="mailto:support@superhost.gr">support@superhost.gr</a>> wrote:<br>
><br>
> I started another thread because the last one was !@#$'ed up by irrelevant replies and was difficult to jeep track.<br>
><br>
> >>> name="abcd"<br>
> >>> month="efgh"<br>
> >>> year="ijkl"<br>
><br>
> >>> print(name or month or year)<br>
> abcd<br>
><br>
> Can understand that, it takes the first string out of the 3 strings that has a truthy value.<br>
><br>
> >>> print("k" in (name and month and year))<br>
> True<br>
><br>
> No clue. since the expression in parenthesis returns 'abcd' how can 'k' contained within 'abcd' ?<br>
><br>
> >>> print(name and month and year)<br>
> ijkl<br>
><br>
> Seems here is returning the last string out of 3 strings, but have no clue why Python doing this.<br>
><br>
> >>> print("k" in (name and month and year))<br>
> True<br>
> >>><br>
><br>
> yes, since expression returns 'ijkl', then the in operator can detect the 'k' character within the returned string.<br>
><br>
> This is all iw ant to know.</p>
<p dir="ltr">You have been explained with both words, links and examples and now you dismiss the previous post because it was "difficult to jeep track"?</p>
<p dir="ltr">Anyway. Search for "short circuit logic". Short circuit logic is why python does it that way.</p>