Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jason Pallone
895 Pointswhat is a iterable?
So is a iterable just really a string or list? like the = 'house' ... house would be the iterable? Thanks
2 Answers

Steven Parker
224,849 PointsThe definition found in the Python Glossary:
Iterable
An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects, and objects of any classes you define with an
__iter__()
method or with a__getitem__()
method that implements Sequence semantics.
An iterable is most often used to control a "for" loop.

Alexander Davison
65,468 PointsAn iterable is a data structure that can be walked through linearly (called iterating). Examples include strings, lists and tuples. As for dictionaries, you can iterate through it, but you can only iterate through either the keys or the values. (Python supports iterating both at once, true, but it's just syntactic sugar.)
In a nutshell it means that you can run a for
loop through it.
I hope this helps! ~Alex
Nicholas Baker
6,964 PointsNicholas Baker
6,964 PointsAn iterable is anything that can be iterated or "stepped" through. So a string like "this" is an iterable and so is a list like ['t', 'h', 1, 's']