+ 3

Iterable

No logro entender sobre a que hace referencia a un objeto iterable...

8th Oct 2020, 6:19 PM
Laura Quintero
Laura Quintero - avatar
4 Answers
+ 2
Iterable object is a container of values, each time a value returns iteratively (on automatical next call ). Ex: for v in "strings": print(v) #here v is assigned iterable string "strings" 1 at a time as v='s', on next iteration v='t'... next until last value. lst = [1,2,3,4] for v in lst : print(v) #here again lst list is an iterable, v is assigned like v=1,next v=2,...v=4 in each next iteration accordingly Similarly tuple, set, dictionary are also works as iterable.. Hope it helps...
8th Oct 2020, 6:43 PM
Jayakrishna 🇼🇳
+ 2
(above one Google translated to this ) El objeto iterable es un contenedor de valores, cada vez que un valor regresa iterativamente (en la siguiente llamada automĂĄtica). Ex: para v en "cadenas": print (v) #aquĂ­ v se asigna una cadena iterable "cadenas" 1 a la vez como v= 's', en la siguiente iteraciĂłn v = 't' ... siguiente hasta el Ășltimo valor. lst = [1,2,3,4] para v en lst: print (v) # aquĂ­ de nuevo la primera lista es iterable, v se asigna como v = 1, siguiente v = 2, ... v = 4 en cada siguiente iteraciĂłn en consecuencia De manera similar, tuple, set, dictionary tambiĂ©n funcionan como iterables. Espero eso ayude....
8th Oct 2020, 6:45 PM
Jayakrishna 🇼🇳
+ 1
Google translated some of your variables i into yo. It won't make sense in spanish.
8th Oct 2020, 7:35 PM
Paul
Paul - avatar
+ 1
@Paul Thats why I added both, (it won't fitting in one post).. Any ways I changed 'i' to 'v' now..... Still further, hoping OP can understand in their language about code..
8th Oct 2020, 7:46 PM
Jayakrishna 🇼🇳