Skip to content

Commit

Permalink
Bug fixes and improvements (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrguseinov authored Jul 19, 2024
1 parent 105994a commit b6cc0e3
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 34 deletions.
2 changes: 1 addition & 1 deletion chapters/chapter-02/chapter-02-quiz-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"\n",
"Which of the following is **not** a Python keyword?\n",
"\n",
"1. `iterate`\n",
"1. `pizza`\n",
"2. `continue`\n",
"3. `else`\n",
"4. `break`"
Expand Down
6 changes: 3 additions & 3 deletions chapters/chapter-02/chapter-02-quiz-2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@
"\n",
"The `input` function has one parameter. What is it?\n",
"\n",
"1. The `prompt` string, which is printed to the standard output before the input is read.\n",
"1. The `prompt` string, which is printed to the terminal <u>before</u> the input is read.\n",
"2. The `input` function has no parameters.\n",
"3. The `prompt` string, which is printed to the standard output after the input is read.\n",
"3. The `prompt` string, which is printed to the terminal <u>after</u> the input is read.\n",
"4. The `input` function has more than one parameter."
]
},
Expand Down Expand Up @@ -366,7 +366,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions chapters/chapter-02/chapter-02-task-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"source": [
"## Task 2.1: Greet User\n",
"\n",
"Use `input()` function to prompt a user for the name and then welcome them.\n",
"Use `input()` function to prompt a user for the name and then use [the f-string syntax](https://realpython.com/python-f-strings/#interpolating-values-and-objects-in-f-strings) to welcome them.\n",
"\n",
"---\n",
"\n",
Expand Down Expand Up @@ -91,7 +91,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -105,7 +105,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions chapters/chapter-02/chapter-02-task-2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
"\n",
"---\n",
"\n",
"After running the cell with `35` and `2.125`, you should see the following output:\n",
"After running the cell with `35.5` and `2.125`, you should see the following output:\n",
"\n",
"```\n",
"Enter hours: 35\n",
"Enter hours: 35.5\n",
"Enter rate: 2.125\n",
"Gross pay: 74.38\n",
"Gross pay: 75.44\n",
"```"
]
},
Expand Down Expand Up @@ -100,7 +100,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -114,7 +114,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
56 changes: 40 additions & 16 deletions chapters/chapter-03/chapter-03-quiz-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@
"\n",
"### Question 0\n",
"\n",
"What should you do to the code that goes immediately after the `if` statement to indicate that it'll only be executed when that `if` statement is `True`?\n",
"What will the following code print out?\n",
"\n",
"```python\n",
"a, b = 12, 5\n",
"if a + b:\n",
" print(\"True\")\n",
"else:\n",
" print(\"False\")\n",
"```\n",
"\n",
"1. Start the code with a `#` character.\n",
"2. Start the code with a `{` character.\n",
"3. Underline `_` all of the conditional code.\n",
"4. Indent (add spaces ` `) the code below the `if` statement."
"1. `12`\n",
"2. `5`\n",
"3. `False`\n",
"4. `True`"
]
},
{
Expand Down Expand Up @@ -125,12 +133,19 @@
"\n",
"### Question 3\n",
"\n",
"When you have multiple lines in an `if` block (body), how do you indicate the end of it?\n",
"What will the following code print out?\n",
"\n",
"1. You use a curly brace `}` after the last line of the `if` block.\n",
"2. You omit the semicolon `;` on the last line of the `if` block.\n",
"3. You de-indent (delete spaces ` `) the next line past the `if` block to the same level of indent as the original `if` statement.\n",
"4. You put the colon `:` character on a line by itself to indicate we are done with the `if` block."
"```python\n",
"if True:\n",
" print(101)\n",
"else:\n",
" print(202)\n",
"```\n",
"\n",
"1. `202`\n",
"2. `True`\n",
"3. `101`\n",
"4. `False`"
]
},
{
Expand Down Expand Up @@ -188,12 +203,21 @@
"\n",
"### Question 5\n",
"\n",
"What keyword should you use in two-way `if` tests to indicate the code block that will be executed if the logical test is `False`?\n",
"What will the following code print out?\n",
"\n",
"```python\n",
"try:\n",
" 1 / 0\n",
"except (ZeroDivisionError, TypeError):\n",
" print(\"Hi!\")\n",
"except Exception:\n",
" print(\"Bye!\")\n",
"```\n",
"\n",
"1. `else`\n",
"2. `except`\n",
"3. `iterate`\n",
"4. `break`"
"1. `Hi!`\n",
"2. `1`\n",
"3. `Bye!`\n",
"4. `0`"
]
},
{
Expand Down Expand Up @@ -404,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions chapters/chapter-05/chapter-05-quiz-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@
"```\n",
"\n",
"1. Find the smallest value in the list.\n",
"2. Count all the values in the list.\n",
"2. Count the number of values in the list.\n",
"3. Find the largest value in the list.\n",
"4. Sum all the values in the list."
"4. Sum the values in the list."
]
},
{
Expand Down Expand Up @@ -390,7 +390,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions chapters/chapter-08/chapter-08-task-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"\n",
"Read the file line by line. For each line, split the line into a list of words using the `split()` method. For each word, check to see if the word is already in the list and if not append it to that list.\n",
"\n",
"Sort the resulting words in alphabetical order and return them.\n",
"Sort the resulting list of words alphabetically and return it.\n",
"\n",
"---\n",
"\n",
Expand Down Expand Up @@ -91,7 +91,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -105,7 +105,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down

0 comments on commit b6cc0e3

Please sign in to comment.