English to Spanish: (Python) IPYNB Notebook General field: Tech/Engineering Detailed field: Computers: Software | |
Source text - English Loops
Range
Sometimes, you might want to repeat a given operation many times. Repeated executions like this are performed by loops. We will look at two types of loops, for loops and while loops.
Before we discuss loops lets discuss the range object. It is helpful to think of the range object as an ordered list. For now, let's look at the simplest case. If we would like to generate a sequence that contains three elements ordered from 0 to 2 we simply use the following command:
# Use the range
range(3) | Translation - Spanish Bucles
Rango
En ocasiones, es necesario repetir la misma operación varias veces. La repetición de operaciones es una tarea de la que se encargan los bucles. Veremos dos tipos, el for y el while.
Antes de discutir el tema de los bucles, hablemos primero del range. Es útil pensar en el rango como una lista ordenada. Por ahora, veamos un caso sencillo. Si quisiéramos generar una secuencia que contenga tres elementos ordenados desde 0 hasta 2 usaríamos este comando:
# Usar el rango
range(3) |