Stop at the first over fifty · Detenerse en el primer valor mayor que 50
Stop at the first over fifty
n starts at 1. Keep adding 1 to it. As soon as n * n is more than 50, leave the loop with break. Print n afterwards.
break leaves the loop at once. ⚠️ It only works inside the loop, so the if that holds it must be indented under the while too — and the break indented once more, under the if. print(n) stays at the left, outside the loop, so it runs after the break.
Detenerse en el primer valor superior a cincuenta
n comienza en 1. Se le suma 1 constantemente. Tan pronto como n * n sea mayor que 50, se sale del bucle con break. Después, se imprime n.
break abandona el bucle de inmediato. ⚠️ Solo funciona dentro del bucle, por lo que el if que lo contiene también debe estar indentado bajo el while — y el break una vez más, indentado debajo del if. print(n) permanece alineado a la izquierda, fuera del bucle, para que se ejecute tras la salida.
n starts at 1. Keep adding 1 to it. As soon as n * n is more than 50, leave the loop with break. Print n afterwards. · n comienza en 1. Sigue sumando 1 a él. En cuanto n * n sea mayor que 50, sal del bucle con break. Imprime n después.
Click Run to see the output here. · Haz clic en Ejecutar para ver la salida aquí.