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([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])
    return (new_list)

2 Answers

Dave StSomeWhere
Dave StSomeWhere
19,809 Points

You are using an undefined variable call counter

unknown member
unknown member
Courses Plus Student 18,937 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.