6
What is the output of the following code?
for i in range(3):
if i == 1:
break
else:
print('done')
print(i)DiscussHard
Loading subject content…
Loading practice questions…
What is the output of the following code?
for i in range(3):
if i == 1:
break
else:
print('done')
print(i)What is the output of the following code?
x = 5
result = 'even' if x % 2 == 0 else 'odd'
print(result)What is the output of the following code?
cmd = 'stop'
match cmd:
case 'go':
print('moving')
case 'stop':
print('halt')
case _:
print('unknown')What is the output of the following code?
total = 0
for x in [3, -1, 4, -5, 2]:
if x < 0:
continue
total += x
print(total)