September 2013
Intermediate to advanced
350 pages
9h 38m
English
Suppose you’re typing in a list of the noble gases and your fingers slip:
| | >>> nobles = ['helium', 'none', 'argon', 'krypton', 'xenon', 'radon'] |
The error here is that you typed ’none’ instead of ’neon’. Here’s the memory model that was created by that assignment statement:

Rather than retyping the whole list, you can assign a new value to a specific element of the list:
| | >>> nobles[1] = 'neon' |
| | >>> nobles |
| | ['helium', 'neon', 'argon', 'krypton', 'xenon', 'radon'] |
Here is the result after the assignment to nobles[1]:
That memory model also shows that list ...
Read now
Unlock full access