$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #229

What is the output?

a = [1, 2, 3]
print(a[10:], a[-10:2])
  1. IndexError
  2. None [1, 2]
  3. [3] [1, 2]
  4. [] [1, 2]
Slices clamp out-of-range bounds instead of raising, unlike plain indexing.
Play Problem Solving ▸