Answer: Python Puzzler #412

The answer is B. The program prints:

BBB
III
TTT
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
BBBB
IIII
TTTT

The code again

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

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