You are creating a movie list for your personal collection. Do the following steps one by one using only list operations:
Create a list named movies with these 3 movies:
'Avatar', 'Inception', 'Titanic'
Add the movie 'Interstellar' to the end of the list.
Add the movie 'The Matrix' to the beginning of the list.
Access and print the third movie in the list.
Update the last movie in the list to 'The Dark Knight'.
Remove the second movie from the list.
Finally, print the full list.
Would you like to try it first?
If you want the solution, here it is below ๐
# Step 1: Create list
movies = ['Avatar', 'Inception', 'Titanic']
# Step 2: Add to end
movies.append('Interstellar')
# Step 3: Add to beginning
movies.insert(0, 'The Matrix')
# Step 4: Access and print third movie
print("Third movie:", movies[2]) # Remember, index starts at 0
# Step 5: Update last movie
movies[-1] = 'The Dark Knight'
# Step 6: Remove second movie (index 1)
movies.pop(1)
# Step 7: Print final list
print("Final movie list:", movies)