Start learning free

LESSON 106 OF 673 · LISTS I

Updating list elements in Python

Lesson

Unlike strings, the entries of lists are mutable and can be changed freely, using indices and the bracket notation:

myList = ["Hello world!", 32, false]

myList[0] = 15
myList[1] = "second element";

print(myList) # Output: [15, "second element", false]

Assignment
Follow the Coding Tutorial and let's play with some arrays.


Hint
Look at the examples above if you get stuck.


STEP 1 OF 2
    Ctrl + Enter to check