What is meaning of iterable?and how list and tuple are iterable? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What is meaning of iterable?and how list and tuple are iterable?

9th Aug 2018, 3:27 PM
Meet Rajpopat
Meet Rajpopat - avatar
3 Réponses
+ 2
Iterating means going from element to element. Imagine you're standing in front of a sorted bookshelf you pull out one book after another, from A to Z. You can also only pull out every second book etc, but as long as you can go through each book from the beginning to the end in a straight line, it means that the bookshelf is iterable.
10th Aug 2018, 12:15 AM
Chris
Chris - avatar
+ 1
Type is iterable if you can iterate through its instance with a `for` loop. Most python collection types are iterable: lists, tuples, strings, dicts, sets, etc.
9th Aug 2018, 3:32 PM
wiad
0
Chris thankyou very much
12th Aug 2018, 4:19 PM
Meet Rajpopat
Meet Rajpopat - avatar