python stop while True loop code example
Example 1: python while true loop
while True:
print("Hi")
Example 2: python better while loop that count up
for number in range(1,101):
print(number)
Example 3: python exit loop iteration
alphabet = ['a' , 'b' , 'c' , 'd' ]
for letter in alphabet:
if letter == 'b' :
continue
#continues to next iteration
print( letter )
for letter in alphabet:
if letter == 'b' :
break
#terminates current loop
print( letter )
for letter in alphabet:
if letter == 'b' :
pass
#does nothing
print( letter )