Skip to content

Question 6

Evaluate:

'abc'[3:5]
Solution

String 'abc' does not have anything at index 3 onwards. In fact, 'abc'[3] will give an IndexError. However, such errors do not appear if you present a slicing range. Hence, the range [3:5], while being outside of what this string caters for, just means an empty selection of the string was made.

Answer
''