Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
igsm '10,440 Points
combo(), tuples and enumerate challenge. Please help.
I do not understand how can we make a new tuple here that combines both iterables? Enumerate already outputs a tuple (index and value), as I understood - tuples are immutable. How can I use enumerate (index) here to build a new list of tuples that combine two iterables ? Thanks
# combo(['swallow', 'snake', 'parrot'], 'abc') # Output: # [('swallow', 'a'), ('snake', 'b'), ('parrot', 'c')] # If you use list.append(), you'll want to pass it a tuple of new values. # Using enumerate() here can save you a variable or two. def combo(i1, i2): the_list =  for step in enumerate(i2):
igsm '10,440 Points
Sorry Kenneth, I am still little bit confused. I understand what output I should get but I cannot get how can I concatenate two iterables into the tulpe by using for loop and enamurate...
Kenneth LoveTreehouse Guest Teacher
You have a good start.
Tuples are immutable, true, but they're only immutable once they've been created. You can, of course, put into them whatever you'd like. So for each step of your
for loop, you make a new tuple w/ two items in it, one from each iterable, and then put that tuple into your
the_list variable. No tuples will be harmed in the running of this loop!