Indexing and slicing a list
Predict the output · Basic · §3.2 The same rules
These are the view counts of five posts. Predict the five lines of output without running the code.
Code
views = [310, 95, 480, 120, 260]
print(views[1])
print(views[-2])
print(views[1:3])
print(views[3:])
print(len(views[1:3]))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.