Answer: Python Puzzler #2830

The answer is B. The program prints:

melon

This answer was checked by running the program for real.

Why?

Python counts list positions from 0, so position 0 is the first item.

Trace table

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

positionnegative positionitem
0-6melon
1-5pear
2-4mango
3-3grape
4-2carrot
5-1plum

The code again

basket = ["melon", "pear", "mango", "grape", "carrot", "plum"]
print(basket[0])

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