aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Brody Critchlow <[email protected]>2023-01-28 11:38:00 -0700
committerGravatar GitHub <[email protected]>2023-01-28 11:38:00 -0700
commit83f3167bdf6d6320dda40d3ed90dbad13ca7c4d0 (patch)
tree5e853249f7d305c3019db90a1cfdc4f609097d04
parentUpdate list names (diff)
Clarify comments
-rw-r--r--bot/resources/tags/in-place.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/bot/resources/tags/in-place.md b/bot/resources/tags/in-place.md
index d120f9b08..7ed957bdc 100644
--- a/bot/resources/tags/in-place.md
+++ b/bot/resources/tags/in-place.md
@@ -7,11 +7,11 @@ A common example of these different concepts is seen in the use of the methods `
```py
inplace_list = [3, 1, 2]
a_new_list = inplace_list.sort() # This will be None
-print(a_new_list[1]) # This will error because it is NoneType and not a list
+print(a_new_list) # Outputs None. Where did the list go?
outofplace_list = [3, 1, 2]
sorted(outofplace_list)
-print(outofplace_list[0]) # You may expect 1, but it will print 3
+print(outofplace_list) # The list still isn't sorted. Why?
```
To avoid these errors and unexpected results, it is required to assign the result of `sorted(...)` to a new variable and use `list.sort()` method in the original list. This way, the original list will be sorted and the new list will be created with the sorted elements.