Skip to content
This repository was archived by the owner on Jun 25, 2018. It is now read-only.

Commit cf75adc

Browse files
committed
Day1 Session3: use markdown for tables
1 parent e7bfcf8 commit cf75adc

File tree

1 file changed

+24
-47
lines changed

1 file changed

+24
-47
lines changed

Introduction_to_python_day_1_session_3.ipynb

+24-47
Original file line numberDiff line numberDiff line change
@@ -211,28 +211,17 @@
211211
"cell_type": "markdown",
212212
"metadata": {},
213213
"source": [
214-
"With conditional execution the question naturally arises as to which expressions are deemed to be true and which false. For the python boolean values <tt>True</tt> and <tt>False</tt> the answer is (hopefully) obvious. Also, the logical states of truth and falsehood that result from conditional checks like “Is x greater than 5?” or “Is y in this list?” are also clear. When comparing values Python has the standard comparison (or relational) operators, some of which we have already seen:\n"
215-
]
216-
},
217-
{
218-
"cell_type": "markdown",
219-
"metadata": {},
220-
"source": [
221-
"<table>\n",
222-
" <tr><th>Operator</th><th>Description</th><th>Example</th></tr>\n",
223-
" <tr><td><tt>==</tt></td><td>equality</td><td><tt>1 == 2 # False</tt></td></tr> \n",
224-
" <tr><td><tt>!=</tt></td><td>non equality</td><td><tt>1 != 2 # True</tt></td></tr> \n",
225-
" <tr><td><tt><</tt></td><td>less than</td><td><tt>1 < 2 # True</tt></td></tr>\n",
226-
" <tr><td><tt><=</tt></td><td>equal or less than</td><td><tt>2 <= 2 # True</tt></td></tr> \n",
227-
" <tr><td><tt>></tt></td><td>greater then</td><td><tt>1 > 2 # False</tt></td></tr> \n",
228-
" <tr><td><tt>>=</tt></td><td>equal or greater than</td><td><tt>1 >= 1 # True</tt></td></tr> \n",
229-
"</table>"
230-
]
231-
},
232-
{
233-
"cell_type": "markdown",
234-
"metadata": {},
235-
"source": [
214+
"With conditional execution the question naturally arises as to which expressions are deemed to be true and which false. For the python boolean values <tt>True</tt> and <tt>False</tt> the answer is (hopefully) obvious. Also, the logical states of truth and falsehood that result from conditional checks like “Is x greater than 5?” or “Is y in this list?” are also clear. When comparing values Python has the standard comparison (or relational) operators, some of which we have already seen:\n",
215+
"\n",
216+
"|Operator |\tDescription |\tExample |\n",
217+
"|---------|-------------|-----------|\n",
218+
"|`==` |\t equality |\t1 == 2 # False |\n",
219+
"|`!=` |\t non equality |\t1 != 2 # True |\n",
220+
"| `<` |\t less than |\t1 < 2 # True |\n",
221+
"| `<=` |\t equal or less than |\t2 <= 2 # True |\n",
222+
"| `>` |\t greater then |\t1 > 2 # False |\n",
223+
"| `>=` |\t equal or greater than |\t1 >= 1 # True |\n",
224+
"\n",
236225
"It is notable that comparison operations can be combined, for example to check if a value is within a range."
237226
]
238227
},
@@ -283,32 +272,20 @@
283272
"cell_type": "markdown",
284273
"metadata": {},
285274
"source": [
275+
"In Python even expressions that do not involve an obvious boolean value can be assigned a status of \"truthfulness\"; the value of an item itself can be forced to be considered as either True or False inside an if statement. For the Python built-in types discussed in this chapter the following are deemed to be False in such a context:\n",
276+
"\n",
277+
"| False value | Description | \n",
278+
"|-------------|-------------|\n",
279+
"| `None` |\tnumeric equality |\n",
280+
"| `False` |\tFalse boolean |\n",
281+
"| `0`\t| 0 integer |\n",
282+
"| `0.0` |\t0.0 floating point |\n",
283+
"| `\"\"` |\tempty string |\n",
284+
"| `()` |\tempty tuple |\n",
285+
"| `[]` |\tempty list |\n",
286+
"| `{}` |\tempty dictonary |\n",
287+
"| `set()` |\tempty set |\n",
286288
"\n",
287-
"In Python even expressions that do not involve an obvious boolean value can be assigned a status of \"truthfulness\"; the value of an item itself can be forced to be considered as either True or False inside an if statement. For the Python built-in types discussed in this chapter the following are deemed to be False in such a context:"
288-
]
289-
},
290-
{
291-
"cell_type": "markdown",
292-
"metadata": {},
293-
"source": [
294-
"<table>\n",
295-
" <tr><th>False value</th><th>Description</th></tr>\n",
296-
" <tr><td><tt>None</tt></td><td>numeric equality</td></tr>\n",
297-
" <tr><td><tt>False</tt></td><td>False boolean</td></tr>\n",
298-
" <tr><td><tt>0</tt></td><td>0 integer</td></tr>\n",
299-
" <tr><td><tt>0.0</tt></td><td>0.0 floating point</td></tr>\n",
300-
" <tr><td><tt>\"\"</tt></td><td>empty string</td></tr>\n",
301-
" <tr><td><tt>()</tt></td><td>empty tuple</td></tr>\n",
302-
" <tr><td><tt>[]</tt></td><td>empty list</td></tr>\n",
303-
" <tr><td><tt>{}</tt></td><td>empty dictonary</td></tr>\n",
304-
" <tr><td><tt>set()</tt></td><td>empty set</td></tr>\n",
305-
"</table>"
306-
]
307-
},
308-
{
309-
"cell_type": "markdown",
310-
"metadata": {},
311-
"source": [
312289
"And everything else is deemed to be True in a conditional context."
313290
]
314291
},

0 commit comments

Comments
 (0)