how to end a while loop python code example
Example 1: python while true loop
while True:
print("Hi")
Example 2: infinite while python
while True:
print('Hello World!')
Example 3: python exit loop iteration
alphabet = ['a' , 'b' , 'c' , 'd' ]
for letter in alphabet:
if letter == 'b' :
continue
print( letter )
for letter in alphabet:
if letter == 'b' :
break
print( letter )
for letter in alphabet:
if letter == 'b' :
pass
print( letter )
Example 4: while not command in python
condition = 3
while not (condition == 0) :
print(condition)
condition = condition - 1