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 trialThurman Ward
2,718 Pointsam I missing something obvious? or is something not working right?
I am trying to do the combo() challenge and i get the error: Bummer: Where's combo()?
# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]
# If you use .append(), you'll want to pass it a tuple of new values.
def combo(ls1, ls2):
count = 0
for item in ls1:
count=+1
t_list[(ls1[count],ls2[count])]
return t_list
2 Answers
Kourosh Raeen
23,733 PointsHi Thurman - You need to first define t_list
before the loop:
# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]
# If you use .append(), you'll want to pass it a tuple of new values.
def combo(ls1, ls2):
count = 0
t_list = []
for item in ls1:
return t_list
Then inside the loop use append()
to add the tuples to the list. You also need to increment count
after appending and not before; otherwise you skip the items at index 0. Last point, count =+ 1
should be count += 1
.
Thurman Ward
2,718 PointsTY !!!! :)