Practice Test Geeks home

PCEP Using the `else` block in loops 5

What is the output of this code?
x = 5

while x > 0:

x -= 1

if x == 2:

break

else:

print('loop ended')

print('after')

Select your answer