Answer: Python Puzzler #1525

The answer is A. The program prints:

AR
What the program prints
Checked by running the program for real.

Why?

word[3:5] is a slice: it starts at position 3 and stops before position 5. Positions count from 0.

Trace table

A trace table follows the program step by step. Here’s this one:

positionletter
0B
1I
2N
3A
4R
5Y

The code again

word = "BINARY"
print(word[3:5])

Try it: change one number in the program and predict the new output before you run it.