Add video and streamline content
This commit is contained in:
parent
6d2c7aeaa1
commit
26983f19fd
3 changed files with 720 additions and 627 deletions
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"\n",
|
||||
"# Chapter 6: Bytes & Text"
|
||||
"# Chapter 6: Text & Bytes"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -19,7 +19,9 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Read [Chapter 6](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/06_text_00_lecture.ipynb) of the book. Then, work through the questions below."
|
||||
"The questions below assume that you have read [Chapter 6](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/06_text_00_lecture.ipynb) in the book.\n",
|
||||
"\n",
|
||||
"Be concise in your answers! Most questions can be answered in *one* sentence."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -47,7 +49,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -61,7 +63,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -80,7 +82,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -94,7 +96,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -122,7 +124,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -136,7 +138,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -150,7 +152,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -164,7 +166,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
" "
|
||||
" < your answer >"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Read [Chapter 6](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/06_text_00_lecture.ipynb) of the book. Then, work through the exercises below. The `...` indicate where you need to fill in your answers. You should not need to create any additional code cells."
|
||||
"The exercises below assume that you have read [Chapter 6](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/06_text_00_lecture.ipynb) in the book.\n",
|
||||
"\n",
|
||||
"The `...`'s in the code cells indicate where you need to fill in code snippets. The number of `...`'s within a code cell give you a rough idea of how many lines of code are needed to solve the task. You should not need to create any additional code cells for your final solution. However, you may want to use temporary code cells to try out some ideas."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -86,21 +88,25 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" is_palindrome = ... # Q3\n",
|
||||
" # answer to Q3\n",
|
||||
" is_palindrome = ...\n",
|
||||
" if ignore_case:\n",
|
||||
" ... # Q3\n",
|
||||
" chars_to_check = # Q1\n",
|
||||
" ...\n",
|
||||
" # answer to Q1\n",
|
||||
" chars_to_check = ...\n",
|
||||
"\n",
|
||||
" for forward_index in range(chars_to_check):\n",
|
||||
" backward_index = ... # Q2\n",
|
||||
" forward = ... # Q2\n",
|
||||
" backward = ... # Q2\n",
|
||||
" # answer to Q2\n",
|
||||
" backward_index = ...\n",
|
||||
" forward = ...\n",
|
||||
" backward = ...\n",
|
||||
"\n",
|
||||
" print(forward, \"and\", backward) # added for didactical purposes\n",
|
||||
"\n",
|
||||
" if ...: # Q3\n",
|
||||
" is_palindrome = ... # Q3\n",
|
||||
" ... # Q3\n",
|
||||
" # answer to Q3\n",
|
||||
" if ...:\n",
|
||||
" is_palindrome = ...\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" return is_palindrome"
|
||||
]
|
||||
|
@ -237,18 +243,21 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" is_palindrome = ... # Q5\n",
|
||||
" # answers from above\n",
|
||||
" is_palindrome = ...\n",
|
||||
" if ignore_case:\n",
|
||||
" ... # Q5\n",
|
||||
" chars_to_check = # Q5\n",
|
||||
" ...\n",
|
||||
" chars_to_check = ...\n",
|
||||
"\n",
|
||||
" for ... in ...: #Q6\n",
|
||||
" # answer to Q6\n",
|
||||
" for ... in ...:\n",
|
||||
"\n",
|
||||
" print(forward, \"and\", backward) # added for didactical purposes\n",
|
||||
"\n",
|
||||
" if ...: # Q5\n",
|
||||
" is_palindrome = ... # Q5\n",
|
||||
" ... # Q5\n",
|
||||
" # answers from above\n",
|
||||
" if ...:\n",
|
||||
" is_palindrome = ...\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" return is_palindrome"
|
||||
]
|
||||
|
@ -337,6 +346,7 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" # answers from above\n",
|
||||
" if ignore_case:\n",
|
||||
" ...\n",
|
||||
" chars_to_check = ...\n",
|
||||
|
@ -346,9 +356,11 @@
|
|||
" print(forward, \"and\", backward) # added for didactical purposes\n",
|
||||
"\n",
|
||||
" if ...:\n",
|
||||
" ... # Q8\n",
|
||||
" # answer to Q8\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" ... # Q8"
|
||||
" # answer to Q8\n",
|
||||
" return ..."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -462,7 +474,9 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" ... # Q11\n",
|
||||
" # answer to Q11\n",
|
||||
" ...\n",
|
||||
" # answers from above\n",
|
||||
" if ignore_case:\n",
|
||||
" text = ...\n",
|
||||
" chars_to_check = ...\n",
|
||||
|
@ -471,7 +485,7 @@
|
|||
" if ...:\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" ..."
|
||||
" return ..."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -584,19 +598,22 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" # answers from above\n",
|
||||
" ...\n",
|
||||
" if ignore_case:\n",
|
||||
" ...\n",
|
||||
" # answer to Q13\n",
|
||||
" if ignore_symbols:\n",
|
||||
" for ... in ...: # Q13\n",
|
||||
" ... # Q13\n",
|
||||
" for ... in ...:\n",
|
||||
" ...\n",
|
||||
" # answers from above\n",
|
||||
" chars_to_check = ...\n",
|
||||
"\n",
|
||||
" for ... in ...:\n",
|
||||
" if ...:\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" ..."
|
||||
" return ..."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -782,6 +799,7 @@
|
|||
" Returns:\n",
|
||||
" is_palindrome (bool)\n",
|
||||
" \"\"\"\n",
|
||||
" # answers from above\n",
|
||||
" ...\n",
|
||||
" if ignore_case:\n",
|
||||
" ...\n",
|
||||
|
@ -789,12 +807,14 @@
|
|||
" for ... in ...:\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" if ...: # Q16\n",
|
||||
" ... # Q16\n",
|
||||
" elif ...: # Q16\n",
|
||||
" ... # Q16\n",
|
||||
" # answer to Q16\n",
|
||||
" if ...:\n",
|
||||
" ...\n",
|
||||
" elif ...:\n",
|
||||
" ...\n",
|
||||
"\n",
|
||||
" return ... # Q17"
|
||||
" # answer to Q17\n",
|
||||
" return ..."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -955,7 +975,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.6"
|
||||
"version": "3.7.4"
|
||||
},
|
||||
"toc": {
|
||||
"base_numbering": 1,
|
||||
|
|
Loading…
Reference in a new issue