question # 2\nmultiple choice\nwhat is the output for the following program?\nfor numx in 3,5:\n for numy in…

question # 2\nmultiple choice\nwhat is the output for the following program?\nfor numx in 3,5:\n for numy in 1,2:\n print (numx, numy)\n3 1\n3 2\n5 1\n5 2

question # 2\nmultiple choice\nwhat is the output for the following program?\nfor numx in 3,5:\n for numy in 1,2:\n print (numx, numy)\n3 1\n3 2\n5 1\n5 2

Answer

Explanation:

Step1: Outer - loop iteration 1

The outer loop iterates over [3, 5]. First, numX = 3. Then the inner - loop iterates over [1, 2]. When numY = 1, print(numX, numY) prints 3 1. When numY = 2, print(numX, numY) prints 3 2.

Step2: Outer - loop iteration 2

Next, in the outer - loop, numX = 5. The inner - loop again iterates over [1, 2]. When numY = 1, print(numX, numY) prints 5 1. When numY = 2, print(numX, numY) prints 5 2.

Answer:

3 1 3 2 5 1 5 2