[Tutor] equality check difference
Vipul Sharma
vipul.sharma20 at gmail.com
Sat Apr 19 22:48:28 CEST 2014
Hello,
Suppose we want some block of code to be executed when both '*a'* and
'*b'*are equal to say 5. Then we can write like :
*if a == 5 and b == 5:*
* # do something*
But a few days ago, I just involuntarily wrote a similar condition check as
:
*if a == b and b == 5:*
* # do something *
which made me think, is there any difference between the two ?
Is there any difference, any difference in the process of evaluation or
execution ? and also which one is the better ?
I think this is a general programming question and not specifically for
python.
P.S. : Newbie here :)
Thanks.
Regards,
Vipul Sharma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140420/3be03685/attachment.html>
More information about the Tutor
mailing list