Answer: Python Puzzler #926

The answer is C. The program prints:

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

Why?

The outer loop runs 2 times (one per row). Inside it, the inner loop adds 4 symbols to line. So you get 2 rows of 4.

Trace table

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

rowline printed
0oooo
1oooo

The code again

for row in range(2):
    line = ""
    for col in range(4):
        line = line + "o"
    print(line)

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