Skip to content

Commit 8ab5aeb

Browse files
author
giumas
committed
updated 003 for logical operators
1 parent 5aba2bc commit 8ab5aeb

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

003_Conditional_Execution.ipynb

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,34 @@
194194
"source": [
195195
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
196196
"\n",
197-
"It is also possible to combine several boolean expressions into a single one by using the **[logical operators](https://docs.python.org/3.6/reference/expressions.html?#boolean-operations)**: `and`, `or`, and `not`."
197+
"It is possible to combine pairs of boolean expressions (**operands**) into a single one using **[logical operators](https://docs.python.org/3.6/reference/expressions.html?#boolean-operations)** such as `and` and `or`. "
198+
]
199+
},
200+
{
201+
"cell_type": "markdown",
202+
"metadata": {},
203+
"source": [
204+
"<img align=\"left\" width=\"6%\" style=\"padding-right:10px;\" src=\"images/key.png\">\n",
205+
"\n",
206+
"It is also possible to invert the result of a boolean expression using the `not` logical operator."
207+
]
208+
},
209+
{
210+
"cell_type": "markdown",
211+
"metadata": {},
212+
"source": [
213+
"The following table summarizes the behavior of these **logical operators**:"
214+
]
215+
},
216+
{
217+
"cell_type": "markdown",
218+
"metadata": {},
219+
"source": [
220+
"| Operator | Usage |\n",
221+
"| -------- | ------------------------------------------------------------------- |\n",
222+
"| `and` | `True` if both the operands are `True`. Otherwise, `False`. |\n",
223+
"| `or` | `True` if either of the operands are `True`. Otherwise, `False`. |\n",
224+
"| `not` | `True` if the following operand is `False`. Othersiwe, `False. |"
198225
]
199226
},
200227
{
@@ -222,6 +249,13 @@
222249
"(8 < 10) and (8 >= 2)"
223250
]
224251
},
252+
{
253+
"cell_type": "markdown",
254+
"metadata": {},
255+
"source": [
256+
"The result of the above code is `True` because both `(8 < 10)` and `(8 >= 2)` operands are `True`."
257+
]
258+
},
225259
{
226260
"cell_type": "markdown",
227261
"metadata": {},

0 commit comments

Comments
 (0)