Start learning free

LESSON 110 OF 673 · LISTS I

Appending Item to List in Python

Lesson

We can add a single element to the end of some list using the .append() method:

teams = ["Chicago Bulls", "Los Angeles Lakers"]

teams.append("Utah Jazz")

print(teams) # Output: ["Chicago Bulls", "Los Angeles Lakers", "Utah Jazz"]

teams.append("Miami Heat")

print(teams) # Output: ["Chicago Bulls", "Los Angeles Lakers", "Utah Jazz", "Miami Heat"]

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