Python Python Collections (2016, retired 2019) Tuples Combo

Its saying couldn't find combo please help here guys

How do I fix this

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)

1 Answer

Hey there Perfect Tinotenda Mashingaidze !

You're close on this. You won't need to assign list1, list2 to iterable1, iterable2. The new_list value is definitely needed. You're thinking correctly about the use of enumerate but is there a different way to do this? What about using the range function since we know that both parameters of the function have the same length? If you're using range, you get one iterable value that you can use as an index against the parameters. Consider the following and add your code where I've left comments:

def combo(x,y):
   Mashingaidzes_awesome_list = []
   '''   
   1. use a for loop with the range function here.  pass range the len of your x param
   2. append your awesome list with a new tuple() value using the index of the params separated by a comma
   3. remember, you can use the append function to create a new tuple by using list.append( (param1[for_loop_index], param2[for_loop_index]) )
   4. return your awesome list
   '''

Let me know if you have other questions. You've got this!!! Keep going!!!