How many times will print execute in the following program?

for i in range(2):
    for j in range(3):
        print(i, j)
                        

Options

  • A. 2
  • B. 3
  • C. 6
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. 6

Detailed Explanation

Explanation: The outer loop runs twice and the inner loop runs three times per iteration: 2 x 3 = 6.