DEV Community

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

Posted on

2

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

Explica este código Python

Dificultad: Fácil

cl = 4
while cl < 9:
    cl = cl + 1
    print(cl, end='-')
Enter fullscreen mode Exit fullscreen mode
  • A. 4-5-6-7-8-
  • B. 5-6-7-8-
  • C. 4-5-6-7-8-9-
  • D. 5-6-7-8-9-

Respuesta:

👉 D. 5-6-7-8-9-

Lo único que se debe hacer para entender este problema es tener en cuenta que primero se hace el incremento de la variable que controla el bucle y luego recién imprimimos su valor. Por ello el primer número en imprimirse es el 5 y el último es el 9.

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay