Sobes.tech
Intern — Middle

Determining the output when accessing a list slice

livecode

Task condition

There is a Python code fragment that outputs a part of a list. The list letters contains the elements ['a', 'b', 'c', 'd']. It is required to find out what the output will be when executing the following code.

Code:

letters = ['a', 'b', 'c', 'd']
print(letters[5:])

Answer options:

  • c
  • b
  • d
  • an error will occur
  • []
  • a