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.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
