PRACTICE / UNDERSTAND / REPEAT

Python practice question

Practice lists & slicing with self-contained questions. Check your answer, then use the explanation to understand the reasoning.

1 questionAnswers explainedFree · no login

Try this question

Lists & slicing · MCQQuestion link ↗

What does this Python code print?

values = [1, 2, 4]
print(values[-1])
Choose one answer
Answer & explanation

Answer: 4

Index -1 selects the last element.