while
The while True condition makes it impossible to exit the loop unless it encounters a break statement.
If you fall into an infinite loop, use ctrl + c on your computer to force termination
count=0
while count<=5:
print(count)
count=count+1
result:
break
count=0
while count<=5:
if count==3:
break
print(count)
count=count+1
Result:
Range is useful when knowing how many times to loop
count=list(range(1,5))
print(count)
while len(count)>0:
first=count[0]
count.remove(first)
print(count)
result: