Learn Python 3 - Loops Cheatsheet - Codecademy
Learn Python 3 - Loops Cheatsheet - Codecademy
Bucles
break Palabra clave
En un bucle, la break palabra clave escapa del bucle,
independientemente del número de iteración. Una vez numbers = [0, 254, 2, -1, 3]
que se break ejecuta, el programa continuará
ejecutándose después del ciclo. for num in numbers:
En este ejemplo, la salida sería: if (num < 0):
print("Negative number detected!")
● 0
break
● 254
print(num)
● 2
In nite Loop
An in nite loop is a loop that never terminates. In nite
loops result when the conditions of the loop prevent it
from terminating. This could be due to a typo in the
conditional statement within the loop or incorrect logic.
To interrupt a Python program that is running forever,
press the Ctrl and C keys together on your keyboard.