8.5k views
5 votes
Make a list of your favorite movies, the list should have minimum 8 elements.

print a spacified list after removing the 5th element, insert your favorite movie director name at the 4th index position of the list.
add additional item to the current list and display the list

python code

User JerH
by
7.2k points

1 Answer

2 votes

Answer:

# Define a list of favorite movies

favorite_movies = ["Avengers: Endgame", "Spider-Man: Into the Spider-Verse", "Captain America: The Winter Soldier", "Iron Man", "Thor: Ragnarok", "Black Panther", "Guardians of the Galaxy", "Doctor Strange"]

# Remove the 5th element (index 4)

del favorite_movies[4]

# Insert favorite director name at index 3

favorite_movies.insert(3, "Taika Waititi")

# Add an additional movie to the list

favorite_movies.append("Shang-Chi and the Legend of the Ten Rings")

# Print the modified list

print(favorite_movies)

hope I helped

User Wwjdm
by
7.2k points