Python replaces the usual C-style boolean operators (&&, ||, !) with words: and, or, and not respectively.
So you can do things like:
if (isLarge and isHappy) or (isSmall and not isBlue):
which makes things more readable.
11
votes
Just on formatting. If you have very long conditions, I like this way of formatting
if (isLarge and isHappy) \
or (isSmall and not isBlue):
pass
It fits in nicely with Python's comb formatting
5
votes
if integer > 3 and integer < 34:
# do work
3
votes
yes like this:
if 3 < integer < 34:
pass
1
votes
Yes, it is:
if integer > 3 and integer < 34:
document.write("something")
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more