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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Python Collections (Retired) Tuples Combo

Completely lost on the last challenge

Here is something I attempted

zippy.py
# 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(x, y):
  count = 0
  for i in enumerate(x):
    return x, y[count]
    count += 1

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

It's a good start. The return will make the count += 1 not ever happen, though.

Using enumerate is a good idea. Remember, enumerate returns you a tuple of the current index and the current value. How could you use that index to get the same-indexed item in the other iterable? Also, you need to be building a list that'll get returned in the end, not just returning the first tuple.