+ 1
How to use continue and break statement in phython???
prob...
2 ответов
+ 3
The "break" keyword is used to break out of a loop(any type of loop).
The "continue" is used to skip an iteration.
Take a look at an example
===============
for i in range(5):
if i > 3:
break
print(i)
Output
======
0
1
2
3
when it gets to 4, it "breaks" out of the loop
Example of "continue"
==================
for i in range(10):
if i == 6:
continue
print(i)
Output
=======
0
1
2
3
4
5
7
8
9
As you can see, 6 is not printed, because when it got to 6, it "continued" without printing 6
+ 1
thank you