Answer: Python Puzzler #507

The answer is B. The program prints:

PPP
III
XXX
EEE
LLL
What the program prints
Checked by running the program for real.

Why?

A for loop can go through a string one letter at a time. Each letter is printed 3 times in a row.

Trace table

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

letterprinted
PPPP
IIII
XXXX
EEEE
LLLL

The code again

for letter in "PIXEL":
    print(letter * 3)

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