diff options
| -rw-r--r-- | bot/resources/tags/or-gotcha.md | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/bot/resources/tags/or-gotcha.md b/bot/resources/tags/or-gotcha.md index 00c2db1f8..2dc1410ad 100644 --- a/bot/resources/tags/or-gotcha.md +++ b/bot/resources/tags/or-gotcha.md @@ -3,7 +3,7 @@ When checking if something is equal to one thing or another, you might think tha if favorite_fruit == 'grapefruit' or 'lemon': print("That's a weird favorite fruit to have.") ``` -After all, that's how you would normally phrase it in plain English. In Python, however, you have to have _complete instructions on both sides of the logical operator_. +While this makes sense in English, it may not behave the way you would expect. In Python, you should have _complete instructions on both sides of the logical operator_. So, if you want to check if something is equal to one thing or another, there are two common ways: ```py @@ -15,3 +15,4 @@ if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon': if favorite_fruit in ('grapefruit', 'lemon'): print("That's a weird favorite fruit to have.") ``` +For more info, see here: [Python Docs - Boolean Operations](https://docs.python.org/3/reference/expressions.html#boolean-operations) |