Skip to content

Commit

Permalink
Add Dall-E bird image and other Demystify fix-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
zstumgoren committed Apr 1, 2024
1 parent 03c87be commit 2cd6d4b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion content/classes_and_oop/elections_oop_code_challenge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "b4557040-ff63-448b-a083-474de0e17748",
"metadata": {},
"outputs": [],
Expand Down
22 changes: 16 additions & 6 deletions content/classes_and_oop/hidden_life_of_objects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@
"source": [
"# The Hidden Life of Objects\n",
"\n",
"Like many programming languages, Python supports a style of coding known as [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), or **OOP**. \n",
"<p align=\"justify\">\n",
"Like many programming languages, Python supports a style of coding known as <a href=\"https://en.wikipedia.org/wiki/Object-oriented_programming\">object-oriented programming</a>, or <strong>OOP</strong>. \n",
"</p>\n",
"\n",
"<img src=\"../files/dalle_birds_assembly_line_20240401.png\" alt=\"dalle image of birds on assembly line\" style=\"float:right; border:2px solid #555; margin: 10px;\" width=\"200\"/>\n",
"\n",
"<p align=\"justify\">\n",
"This powerful coding paradigm allows you to combine data and code into objects.\n",
"</p>\n",
"\n",
"The mechanism for this blending of data and code is a [class](https://docs.python.org/3/tutorial/classes.html). We typically create classes to model some entity and its related attributes and behaviors.\n",
"<p align=\"justify\">\n",
"The mechanism for this blending of data and code is a <a href=\"https://docs.python.org/3/tutorial/classes.html\">class</a>. We typically create classes to model some entity and its related attributes and behaviors.\n",
"</p>\n",
"\n",
"For example, we've included a fun little `Bird` class in the [awesome.py](awesome.py) module. To use this class, you simply call it using parentheses `()`, the same way that you would call a function."
"<p align=\"justify\">\n",
"For example, we've included a fun little <code>Bird</code> class in the <a href=\"awesome.py\">awesome.py</a> module. To use this class, you simply call it using parentheses <strong><code>()</code></strong>, the same way that you would call a function.\n",
"</p>\n"
]
},
{
Expand Down Expand Up @@ -332,7 +342,7 @@
"source": [
"The `return` statement above allows you to get \"stuff\" back out of a function. \n",
"\n",
"The so-called \"return value\" can a number, text, list, dictionary - basically any Python object that makes sense for your program's needs.\n",
"The so-called \"return value\" can be a number, text, list, dictionary - basically any Python object that makes sense for your program's needs.\n",
"\n",
"In this case, our `add_numbers` function requires you to pass in two numbers, and then returns their sum. \n",
"\n",
Expand Down Expand Up @@ -366,11 +376,11 @@
"id": "a25e89ff-a60f-4f74-8817-098c22a93abe",
"metadata": {},
"source": [
"And of courrse, methods can also have return value.\n",
"And of courrse, methods can also have a return value.\n",
"\n",
"**When dealing with functions/methods, it's important to understand what type of data is being returned.**\n",
"\n",
"This concept of return values will help us finally unravel those long \"chains\" of method calls that we mentioned at the start of this tutorial (they're especially prevelant in `pandas` data analysis code).\n",
"This concept of return values will help us finally unravel those long \"chains\" of method calls that we mentioned at the start of this tutorial (they're especially prevalent in `pandas` data analysis code).\n",
"\n",
"But first, let's close the loop on the simple case of individual method calls on a single instance."
]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2cd6d4b

Please sign in to comment.