Skip to content

Question 6

Evaluate:

('xmas' * 3)[-8:-2][-1]
Hint

Work out the expression from left to right in stages.

Solution
('xmas' * 3)[-8:-2][-1]
= 'xmasxmasxmas'[-8:-2][-1]
= 'xmasxm'[-1]
= 'm'
Answer
'm'