Commit a00db22
Your Name
Use list instead of tuple in variable swapping exercise.
> right, left = left, right
> "...we pack right and left into a tuple and then unpack it again into left
> and right."
This example for variable value swapping introduces three new concepts:
1. the tuple data type
2. special tuple syntax, omitting parentheses
3. container unpacking in an assignment
I think using a list is much clearer, and only introduces the concept of
container unpacking.
right, left = [left, right]1 parent 4f56886 commit a00db22
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
491 | | - | |
| 491 | + | |
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| |||
0 commit comments