Skip to content

Commit e77614c

Browse files
committed
differences for PR #700
1 parent 5c71be4 commit e77614c

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

01-run-quit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ Table: Showing some markdown syntax and its rendered output.
355355
| ``` | <p></p> |
356356
| 1. Use numbers | 1. Use numbers |
357357
| 1. to create | 2. to create |
358-
| 1. numbered lists. | 3. numbered lists. |
358+
| 1. bullet lists. | 3. numbered lists. |
359359
| ``` | |
360360
+---------------------------------------+------------------------------------------------+
361361
+---------------------------------------+------------------------------------------------+

03-types-conversion.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,29 +173,55 @@ half is 0.5
173173
three squared is 9.0
174174
```
175175

176-
## Variables only change value when something is assigned to them.
176+
## Assignment changes the value of a variable, it does not create links between variables.
177+
178+
- In the spreadsheet context,
179+
- If we use a formula to connect one cell to another,
180+
and update the latter,
181+
the former updates automatically.
182+
- In contrast, if we copy one cell and paste its contents into another cell,
183+
the second cell will not update if the first cell changes.
184+
To update the second cell, we would need to copy and paste again.
185+
- Assignment (the `=` operator) in python works like copy and paste in spreadsheets
186+
not like a spreadsheet formula connecting the two cells.
187+
In other words, after a variable is used to assign a value to another variable,
188+
reassigning the first variable does not change the second variable.
189+
190+
To demonstrate this:
177191

178-
- If we make one cell in a spreadsheet depend on another,
179-
and update the latter,
180-
the former updates automatically.
181-
- This does **not** happen in programming languages.
192+
```python
193+
a = 1
194+
b = a
195+
a = 2
196+
print('a is', a, 'and b is', b)
197+
```
198+
199+
```output
200+
a is 2 and b is 1
201+
```
202+
203+
When `b = a` is run, `a`'s value (`1`) is assigned to `b`, but no ongoing link is created between `a` and `b`.
204+
205+
Here is a slightly more complicated example involving computation on the second value:
182206

183207
```python
184208
variable_one = 1
185209
variable_two = 5 * variable_one
186210
variable_one = 2
187-
print('first is', variable_one, 'and second is', variable_two)
211+
print('variable_one is', variable_one, 'and variable_two is', variable_two)
188212
```
189213

190214
```output
191-
first is 2 and second is 5
215+
variable_one is 2 and variable_two is 5
192216
```
193217

194-
- The computer reads the value of `variable_one` when doing the multiplication,
218+
- Python reads the value of `variable_one` when doing the multiplication,
195219
creates a new value, and assigns it to `variable_two`.
196-
- Afterwards, the value of `variable_two` is set to the new value and *not dependent on `variable_one`* so its value
220+
- Afterwards, `variable_two` is set to this new value and *is not dependent on `variable_one`* so its value
197221
does not automatically change when `variable_one` changes.
198222

223+
Some data types that we haven't encountered yet (e.g. _lists_, _dictionaries_, and _objects_) have "links" inside them so they behave somewhat differently when you assign values to their *contents*. An example of this is shown in [Episode 12: Lists](../11-lists.md#copying-or-not). Assigning a list value to a new variable is like copying and pasting a formula from one cell to another. When you update an item in that list with the new value, you're updating that item in the original list as well.
224+
199225
::::::::::::::::::::::::::::::::::::::: challenge
200226

201227
## Fractions

16-writing-functions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ print_greeting()
5858

5959
```output
6060
Hello!
61-
The weather is nice today.
62-
Right?
6361
```
6462

6563
## Arguments in a function call are matched to its defined parameters.

md5sum.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"config.yaml" "4c8c3b66083d754c51eae2c277d24ca0" "site/built/config.yaml" "2023-05-02"
55
"index.md" "f019634aead94a6e24c7b0a414239caa" "site/built/index.md" "2023-05-03"
66
"links.md" "e64df47952f39ef6e4439db795b92c15" "site/built/links.md" "2024-12-10"
7-
"episodes/01-run-quit.md" "e3ee1d5249e686f45310919199b6ed8f" "site/built/01-run-quit.md" "2025-11-12"
7+
"episodes/01-run-quit.md" "ca5737c8a9dc8c8e16f8320550a93787" "site/built/01-run-quit.md" "2025-11-17"
88
"episodes/02-variables.md" "9dacd8cd9968b5d0185f0c244a55eb84" "site/built/02-variables.md" "2023-05-02"
9-
"episodes/03-types-conversion.md" "9e3a08116a2124cd8e23d1d7c5dba432" "site/built/03-types-conversion.md" "2023-05-02"
9+
"episodes/03-types-conversion.md" "cb50f1c6770a17454cb02c6731a4ba9b" "site/built/03-types-conversion.md" "2025-11-17"
1010
"episodes/04-built-in.md" "e91afeb3e74fb132970be01eaae403ca" "site/built/04-built-in.md" "2025-04-01"
1111
"episodes/05-coffee.md" "c7616ec40b9e611c47b2bac1e11c47d2" "site/built/05-coffee.md" "2023-05-02"
1212
"episodes/06-libraries.md" "96899c58843e51f10eb84a8ac20ebb90" "site/built/06-libraries.md" "2023-05-02"
@@ -19,7 +19,7 @@
1919
"episodes/13-conditionals.md" "2739086f688f386c32ce56400c6b27e2" "site/built/13-conditionals.md" "2024-02-16"
2020
"episodes/14-looping-data-sets.md" "9893b774bd5d583592d39a66f69ea68a" "site/built/14-looping-data-sets.md" "2024-12-03"
2121
"episodes/15-coffee.md" "062bae79eb17ee57f183b21658a8d813" "site/built/15-coffee.md" "2023-05-02"
22-
"episodes/16-writing-functions.md" "15b3da2d04c9f704ed5615a742cd5d5d" "site/built/16-writing-functions.md" "2025-11-17"
22+
"episodes/16-writing-functions.md" "a87b7fd96770bd8c24d695ef529b93ce" "site/built/16-writing-functions.md" "2025-11-17"
2323
"episodes/17-scope.md" "8109afb18f278a482083d867ad80da6e" "site/built/17-scope.md" "2023-05-02"
2424
"episodes/18-style.md" "67f9594a062909ef15132811d02ee6a0" "site/built/18-style.md" "2023-07-29"
2525
"episodes/19-wrap.md" "8863b58685fecbc89a6f5058bde50307" "site/built/19-wrap.md" "2023-05-02"

0 commit comments

Comments
 (0)