Question 7
Consider the following snippet of code. What will the output be?
result = 0
for i in range(1, 4):
for j in range(1, 4):
if i == j:
continue
if i + j > 4:
break
result += i + j
print(result)
Consider the following snippet of code. What will the output be?
result = 0
for i in range(1, 4):
for j in range(1, 4):
if i == j:
continue
if i + j > 4:
break
result += i + j
print(result)
Correct answer: 14
Question 7 of 14 in the IIT Madras BS Programming in Python (Python) Quiz 1 paper sat on 13 Jul 2025, in the May 2025 term (IIT M DIPLOMA AN EXAM QDD2 13 July 2025). It carries 3 marks.