Skip to content

Commit

Permalink
Add and update quiz questions (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrguseinov authored Mar 9, 2024
1 parent 9046542 commit 6885106
Show file tree
Hide file tree
Showing 3 changed files with 420 additions and 16 deletions.
32 changes: 16 additions & 16 deletions chapters/chapter-06/chapter-06-quiz-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"\n",
"### Question 2\n",
"\n",
"How would you use the index operator `[]` to print out the letter `q` from the following string?\n",
"How to use the index operator `[]` to print the letter `q` from the following string?\n",
"\n",
"```python\n",
"x = \"From marquard@uct.ac.za\"\n",
Expand Down Expand Up @@ -139,7 +139,7 @@
"\n",
"### Question 3\n",
"\n",
"How would you use string slicing to print out `'uct'` from the following string?\n",
"How to use string slicing to print `'uct'` from the following string?\n",
"\n",
"```python\n",
"x = \"From marquard@uct.ac.za\"\n",
Expand All @@ -165,25 +165,25 @@
},
{
"cell_type": "markdown",
"id": "going-freeze",
"id": "1489cae1-1cbf-48e7-befa-eff43a87be55",
"metadata": {},
"source": [
"<hr>\n",
"\n",
"### Question 4\n",
"\n",
"What is the \"iteration variable\" in the following Python code?\n",
"What will the following code print out?\n",
"\n",
"```python\n",
"for letter in \"banana\":\n",
" print(letter)\n",
"text = \"hello world again\"\n",
"print(f\"{text[:5]} {text[-5:]}\")\n",
"```\n",
"\n",
"1. `in`\n",
"2. `print`\n",
"3. `letter`\n",
"4. `for`\n",
"5. `\"banana\"`"
"1. `helloagain`\n",
"2. `hello again`\n",
"3. `hello again`\n",
"4. `hello gain`\n",
"5. `ello again`"
]
},
{
Expand Down Expand Up @@ -236,7 +236,7 @@
"\n",
"### Question 6\n",
"\n",
"How would you print out the following variable in all upper case in Python?\n",
"How to print the following variable in all upper case in Python?\n",
"\n",
"```python\n",
"greet = \"Hello Bob\"\n",
Expand Down Expand Up @@ -342,12 +342,12 @@
"\n",
"### Question 9\n",
"\n",
"Which of the following string methods removes whitespace from both the beginning and end of a string?\n",
"Which method removes whitespace from both the beginning and end of a string?\n",
"\n",
"1. `strip`\n",
"2. `strtrunc`\n",
"3. `split`\n",
"4. `wsrem`"
"4. `strrem`"
]
},
{
Expand Down Expand Up @@ -391,7 +391,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -405,7 +405,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 6885106

Please sign in to comment.