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.

Python Python Collections (2016, retired 2019) Tuples Combo

Thomas Trabue
Thomas Trabue
11,807 Points

Can't figure out what is wrong with my answer to the "combo" problem...

Hello ladies and gentlemen,

I feel pretty silly for asking this, but I simply cannot see what is wrong with my answer to the "combo" problem at the end of one of the Python Collections modules. Here is Kenneth Love's description of the problem:

Create a function named combo that takes two ordered iterables. These could be tuples, lists, strings, whatever. Your function should return a list of tuples. Each tuple should hold the first item in each iterable, then the second set, then the third, and so on. Assume the iterables will be the same length.

My code should be attached. I have run it on a number of test cases and they all came out correct, and I am not getting any useful output from the Treehouse answer checker. Thanks in advance!

# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]

def combo(iter_a, iter_b):
    length = len(iter_a)
    combo_list = []
    for i in range(0, length):
        combo_list.append((iter_a[i], iter_b[i]))
    return combo_list

1 Answer

Eric M
Eric M
11,515 Points

Hi Thomas,

Your code is good! It passed the challenge for me on a copy/paste.

It seems like you're running into an issue with the workspaces. This can happen sometimes, I personally experienced it a couple of times going through the Treehouse Python material.

If you log out of Treehouse, clear your browser cache, and restart your browser you should be able to come back and complete the challenge.

Sorry, I know it's frustrating!



Thomas Trabue
Thomas Trabue
11,807 Points

Thanks so much for the quick response, Eric! That did it! I'll have to bear that in mind as I move forward.