DEV Community

Cover image for Ibuprofeno.py💊| #170: Explica este código Python
Cristian Fernando
Cristian Fernando

Posted on

2

Ibuprofeno.py💊| #170: Explica este código Python

Explica este código Python

Dificultad: Fácil

for k in range(3, 9, 2):
    print(k, end=' ')
Enter fullscreen mode Exit fullscreen mode
  • A. 5 6 7
  • B. 3 5 7
  • C. 3 6 9
  • D. Error

Respuesta:

👉 B. 3 5 7

El método range() de Python acepta 3 parametros: inicio, fin y salto; donde marcamos desde y hasta donde se ejevutará el bucle y el salto de cuento en cuanto "brincará" el bucle.

En nuestro caso el ciclo iniciará en 3, terminará en 8 y saltará de 3 en 3 posiciones. La salida será 3 5 7.

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more