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

I'm stuck on tuples code challange

I'm totaly stuck on this. I need to return a tuple that is a combonation of the two input iterables. So I'm trying to build up out_list by appending each new tuple. But I can't seem to create the tuple to pass to list.append. Python either complains about too many values or can't find the function.

# 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(arg_it1, arg_it2):
  out_list = []
  for step, value in enumerate(arg_it1):
    out_list.append(value, arg_it2[step])
  return out_ret
Mustafa Bayramov
Mustafa Bayramov
4,778 Points

You need parentheses.
out_list.append((value, arg_it2[step]))

1 Answer

OK, I got it. Typo in the last line didn't exactly help. Why did my fingers type out_ret instead of out_list?? Bad fingers!

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You can't trust fingers as far as you can throw them.