Skip to content

Commit f9d3f73

Browse files
committed
minor example edits
1 parent 0987990 commit f9d3f73

File tree

1 file changed

+158
-9
lines changed

1 file changed

+158
-9
lines changed

1_Basics/00_Intro_To_Programming.ipynb

Lines changed: 158 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,68 @@
8080
"90000"
8181
]
8282
},
83+
{
84+
"cell_type": "markdown",
85+
"id": "1ef640ba",
86+
"metadata": {},
87+
"source": [
88+
"Everything in Python is an object; including functions and classes."
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": 6,
94+
"id": "4d55db87",
95+
"metadata": {},
96+
"outputs": [
97+
{
98+
"name": "stdout",
99+
"output_type": "stream",
100+
"text": [
101+
"\n"
102+
]
103+
}
104+
],
105+
"source": [
106+
"print()"
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": 7,
112+
"id": "aaa5da4b",
113+
"metadata": {},
114+
"outputs": [
115+
{
116+
"data": {
117+
"text/plain": [
118+
"str"
119+
]
120+
},
121+
"execution_count": 7,
122+
"metadata": {},
123+
"output_type": "execute_result"
124+
}
125+
],
126+
"source": [
127+
"str"
128+
]
129+
},
83130
{
84131
"cell_type": "markdown",
85132
"id": "fe74bb60",
86133
"metadata": {},
87134
"source": [
88-
"### Variables: The Building Blocks\n",
135+
"### Variables: The Reference to Objects\n",
89136
"\n",
90137
"Think of a variable as a cell in an Excel spreadsheet. You can store data in it, like a number, text, or a formula.\n",
91138
"\n",
92139
"**Variable**: A named cell that stores an object."
93140
]
94141
},
95-
{
96-
"cell_type": "markdown",
97-
"id": "f667cde9",
98-
"metadata": {},
99-
"source": []
100-
},
101142
{
102143
"cell_type": "code",
103-
"execution_count": 71,
144+
"execution_count": 1,
104145
"id": "0fb0d189",
105146
"metadata": {},
106147
"outputs": [],
@@ -110,12 +151,120 @@
110151
"job_salary = 90000"
111152
]
112153
},
154+
{
155+
"cell_type": "code",
156+
"execution_count": 3,
157+
"id": "a03cbbf0",
158+
"metadata": {},
159+
"outputs": [
160+
{
161+
"data": {
162+
"text/plain": [
163+
"(4594639152, 4594645744, 4593144944)"
164+
]
165+
},
166+
"execution_count": 3,
167+
"metadata": {},
168+
"output_type": "execute_result"
169+
}
170+
],
171+
"source": [
172+
"# each variable has a unique identifier\n",
173+
"id(job_title), id(job_location), id(job_salary)"
174+
]
175+
},
176+
{
177+
"cell_type": "markdown",
178+
"id": "864e8619",
179+
"metadata": {},
180+
"source": [
181+
"Variables that reference the same object are the same."
182+
]
183+
},
184+
{
185+
"cell_type": "code",
186+
"execution_count": 2,
187+
"id": "4b917379",
188+
"metadata": {},
189+
"outputs": [
190+
{
191+
"data": {
192+
"text/plain": [
193+
"'Data Analyst'"
194+
]
195+
},
196+
"execution_count": 2,
197+
"metadata": {},
198+
"output_type": "execute_result"
199+
}
200+
],
201+
"source": [
202+
"lukes_job = job_title\n",
203+
"\n",
204+
"lukes_job"
205+
]
206+
},
207+
{
208+
"cell_type": "code",
209+
"execution_count": 5,
210+
"id": "fc07b63c",
211+
"metadata": {},
212+
"outputs": [
213+
{
214+
"data": {
215+
"text/plain": [
216+
"(4594639152, 4594639152)"
217+
]
218+
},
219+
"execution_count": 5,
220+
"metadata": {},
221+
"output_type": "execute_result"
222+
}
223+
],
224+
"source": [
225+
"# the id of the same object is the same\n",
226+
"id(job_title), id(lukes_job)"
227+
]
228+
},
229+
{
230+
"cell_type": "markdown",
231+
"id": "f367a47d",
232+
"metadata": {},
233+
"source": [
234+
"Variables may be assigned the same name, but aren't necessarily the same."
235+
]
236+
},
237+
{
238+
"cell_type": "code",
239+
"execution_count": 8,
240+
"id": "a5aa7f31",
241+
"metadata": {},
242+
"outputs": [
243+
{
244+
"data": {
245+
"text/plain": [
246+
"(4594562480, 4594554352)"
247+
]
248+
},
249+
"execution_count": 8,
250+
"metadata": {},
251+
"output_type": "execute_result"
252+
}
253+
],
254+
"source": [
255+
"job_title1 = \"Data Analyst\"\n",
256+
"job_title2 = \"Data Analyst\"\n",
257+
"\n",
258+
"# the id of the same object is the same\n",
259+
"id(job_title1), id(job_title2)"
260+
]
261+
},
113262
{
114263
"cell_type": "markdown",
115264
"id": "c246c6c4",
116265
"metadata": {},
117266
"source": [
118-
"### Functions: The General Tools\n",
267+
"### Functions: The Manipulators of Objects\n",
119268
"\n",
120269
"Functions are like custom formulas in Excel. They perform tasks that can be applied to different sets of data.\n",
121270
"\n",

0 commit comments

Comments
 (0)