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 trialPerfect Tinotenda Mashingaidze
5,070 PointsIts saying couldn't find combo please help here guys
How do I fix this
# 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
Fergus Clare
12,120 PointsHey 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!!!