python break loop if code example
Example 1: python get out of loop
while True:
print('I run!')
break
print('Not in loop!')
Example 2: how to break a loop in python
x = 0
while True:
x += 1
if x == 10:
break
while True:
print('I run!')
break
print('Not in loop!')
x = 0
while True:
x += 1
if x == 10:
break