DEV Community

Cristian Fernando
Cristian Fernando

Posted on • Edited on

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

Explica este código Python

Dificultad: Básico

for i in range(7):
    print(i)
Enter fullscreen mode Exit fullscreen mode
  • A. 1 2 3 4 5 6 7
  • B. 0 1 2 3 4 5 6 7
  • C. 0 1 2 3 4 5 6
  • D. Ninguna de las anteriores

Respuesta en el primer comentario.

Top comments (1)

Collapse
 
duxtech profile image
Cristian Fernando • Edited

Respuesta:

  • C. 0 1 2 3 4 5 6

La función range en Python solo acepta como parámetro obligatorio el final del intervalo que queremos crear, en este caso: inicio = 0, final = 7, salto = 1, en otras palabras tendremos un intervalo entre 0 y 7-1 que vaya de uno en uno.

La salida tiene que ser: 0, 1, 2, 3, 4, 5, 6

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

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

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay