In [1]:
i = 0
while i < 3:
print(i)
i += 1
In [2]:
i = 0
while i < 3:
print(i)
if i == 1:
print('!!BREAK!!')
break
i += 1
In [3]:
i = 0
while i < 3:
if i == 1:
print('!!CONTINUE!!')
i += 1
continue
print(i)
i += 1
In [4]:
i = 0
while i < 3:
print(i)
i += 1
else:
print('!!FINISH!!')
In [5]:
i = 0
while i < 3:
print(i)
if i == 1:
print('!!BREAK!!')
break
i += 1
else:
print('!!FINISH!!')
In [6]:
i = 0
while i < 3:
if i == 1:
print('!!SKIP!!')
i += 1
continue
print(i)
i += 1
else:
print('!!FINISH!!')
In [7]:
import time
start = time.time()
while True:
time.sleep(1)
print('processing...')
if time.time() - start > 5:
print('!!BREAK!!')
break
In [8]:
start = time.time()
while 1:
time.sleep(1)
print('processing...')
if time.time() - start > 5:
print('!!BREAK!!')
break
In [9]:
start = time.time()
while time.time() - start <= 5:
time.sleep(1)
print('processing...')
else:
print('!!FINISH!!')