0
while loop function | continue | break
i=0 while True: i=i+1 print(i) if i==2: print('2 was skipped') continue if i==5: print('break') break print('finished') output is 1 2 2 was skipped 3 4 5 break finished the problem is that 2 how to i remove that some one plese help me
2 ответов
+ 3
Try this:
i=0
while True:
i=i+1
if i==2:
print('2 was skipped')
continue
elif i==5:
print('break')
break
else:
print(i)
print('finished')
0
it's good but i need using only continue and break operation
and thank for your kind information I got it
i=0
while True:
i=i+1
print(i)
if i==1:
print('2 was skipped')
i=i+1
continue
if i==5:
print('break')
break
print('finished')