Skip to content

Question 5

Evaluate:

'qrstuvw'[3:4]
Solution

String slicing: [start:stop:step]

  • start: include character from this index onwards
  • stop: exclude character from this index onwards
  • step: advance by how many places at once (negative values means advancing backwards) - not specified here

The character at index 3 is t, and since we exclude characters from index 4 onwards, we do not include the next character (i.e., u).

Answer
't'