Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made edits to lessons and practices 1-9 #61

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Lessons/Lesson09_Conditionals.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,32 @@
"# copy and paste if/elif/else from before\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note: We don't use 'is' or == with Boolean values. Instead, we just the value itself instead of == True; or not for == False). For example:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_list = [0, 1, 2, 3, 4, 5, 6, 7]\n",
"\n",
"is_short = len(my_list) < 10\n",
"is_medium = not is_short and len(my_list) < 20\n",
"\n",
"if is_short:\n",
" print(\"This list is short!\")\n",
"elif is_medium:\n",
" print(\"This list is a medium length.\")\n",
"else:\n",
" print(\"This list is on the long side!\")"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
4 changes: 2 additions & 2 deletions Practices/Practice03_Variables_Types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@
"\n",
" Customer Name: Marlena Duda\n",
" Starting Balance: $100\n",
"Years Saved: 7\n",
"Ending Balance: $194.87\n",
" Years Saved: 7\n",
" Ending Balance: $194.87\n",
" Doubled Starting: False\n",
"\n",
"Remember: Use the variable names we defined above whenever you can! "
Expand Down
12 changes: 6 additions & 6 deletions Practices/_Keys/KEY_Practice03_Variables_Types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@
},
{
"ename": "TypeError",
"evalue": "must be str, not int",
"evalue": "can only concatenate str (not \"int\") to str",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-6d47cd2526cd>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;31m# read the error message you get carefully!\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;31m# learning how to read error messages will give you the keys to fix mistakes (i.e. bugs) in your code\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0mfull_name\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mstart_balance\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: must be str, not int"
"Cell \u001b[0;32mIn[4], line 19\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mprint\u001b[39m(full_name)\n\u001b[1;32m 16\u001b[0m \u001b[38;5;66;03m# now try to add full_name to the variable start_balance from above. Does this work?\u001b[39;00m\n\u001b[1;32m 17\u001b[0m \u001b[38;5;66;03m# read the error message you get carefully! \u001b[39;00m\n\u001b[1;32m 18\u001b[0m \u001b[38;5;66;03m# learning how to read error messages will give you the keys to fix mistakes (i.e. bugs) in your code\u001b[39;00m\n\u001b[0;32m---> 19\u001b[0m \u001b[43mfull_name\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mstart_balance\u001b[49m\n",
"\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str"
]
}
],
Expand Down Expand Up @@ -366,8 +366,8 @@
"\n",
" Customer Name: Marlena Duda\n",
" Starting Balance: $100\n",
"Years Saved: 7\n",
"Ending Balance: $194.87\n",
" Years Saved: 7\n",
" Ending Balance: $194.87\n",
" Doubled Starting: False\n",
"\n",
"Remember: Use the variable names we defined above whenever you can! "
Expand Down Expand Up @@ -429,7 +429,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.9.6"
}
},
"nbformat": 4,
Expand Down