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 (2016, retired 2019) Tuples Combo

Couldn't find combo

I've logged in and logged out multiple times and I still get error message couldn't find combo but I have a function called Combo. Can someone explain what I am doing wrong pls.

combo.py
# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]
def combo(iterable1, iterable2):
    list1 = iterable1
    list2 = iterable2
    new_list = []
    for item, x in enumerate(list1):
        new_tuple = (x, list2[counter])
        new_list.append(new_tuple)
    return (new_list)

2 Answers

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

You are using an undefined variable call counter

unknown member
PLUS
unknown member
Courses Plus Student 18,949 Points

You don't need to reassign iterable1 and iterable2, it doesn't make any sense. You can throw away first two lines of defined function. The crirical point why the function doesn't work is that counter is not defined, in order to fix this - change counter into item or put counter instead of item in the loop.