Skip to content

Commit 469ac23

Browse files
authored
Merge pull request #123 from ndporter/patch-1
Use append instead of re-assigning full list
2 parents 073418e + 02a238b commit 469ac23

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

episodes/for-loops.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ We can call the loop variable anything we like, there must be a colon at the end
9191
Loops are more robust ways to deal with containers like lists. Even if the values of the `odds` list changes, the loop will still work.
9292

9393
```python
94-
odds = [1, 3, 5, 7, 9, 11]
94+
odds.append(9)
95+
odds.append(11)
96+
print(odds)
9597
for num in odds:
9698
print(num)
9799
```
98100

99101
```output
102+
[1, 3, 5, 7, 9, 11]
100103
1
101104
3
102105
5

0 commit comments

Comments
 (0)