April 24, 2024, 11 a.m. | Cristian Fernando

DEV Community dev.to


Explica este código Python




Dificultad: Intermedio



i = range(6)
print(type(i))


👉 A. <class 'tuple'>

👉 B. <class 'list'>

👉 C. <class 'range'>

👉 D. <class 'int'>



Respuesta:

👉 C. <class 'range'>


Cuando usamos la función range() creamos un objeto de tipo de range en Python. Los objetos de tipo range son eficientes y óptimos para ser recorridos por bucles.


beginners class list programming python son spanish type

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York