$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #177

Which fix removes the bug?

nums = [1, 2, 3]
print(nums[len(nums)])
  1. Index with len - 1
  2. Use a while loop
  3. Convert to a tuple
  4. Slice with [0:len]
Indices run 0..len-1, so len itself is always one past the end.
Play Problem Solving ▸