Python - 14
Python - 14: Working With Lists
Lists come with built-in methods that let you add, remove, and work with items more easily.
Your challenge: Add a new item, remove an existing one, count the items, and loop through the updated list.
Add an item
Use append() to add an item to the end of a list: games.append("Game Four")
Remove an item
Use remove() with the value you want to delete: games.remove("Game Two")
Count the items
Use len(games) to find how many items are currently in the list.
Loop through the list
A for loop can visit every item: for game in games:
Try it: Add two more games, remove one, then check the new list length.
Good Python habit: Remember that methods like append() and remove() change the original list.
👀 Show Example Solution
games = ["Game One", "Game Two", "Game Three"]
games.append("Game Four")
games.remove("Game Two")
print("Number of games:", len(games))
for game in games:
print(game)