Inserting, removing, and popping
Predict the output · Medium · §3.3 Changing lists
This code changes the list of tags on a post. Predict the two lines of output without running the code.
Code
tags = ["cafe", "food", "cafe", "travel"]
tags.insert(2, "news")
tags.remove("cafe")
last = tags.pop()
print(last)
print(tags)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.