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 trialRaph Hennessy
2,197 PointsWhy is the incorrect?
I wrote my code for this code challenge, and got this error:
Bummer! Didn't get the right output! Expected (10,'T'), got (10,'T')
Like, I think i'm missing something, because the expected and got values are identical. I also tried running this in the IDE and it worked perfectly.
Any help would be appreciated. Thanks :)
# 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(itr1,itr2):
tup_list = tuple(zip(itr1,itr2))
return tup_list
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsYou are very close. You are correct that the zip()
function must be wrapped in a function to extract all the values. The key is the challenge asks for a function that "returns a list of tuples
", not a tuple of tuples. Change your wrapping tuple()
to list()
to pass the challenge:
def combo(itr1,itr2):
tup_list = list(zip(itr1,itr2)) # <-- changed to list()
return tup_list
Raph Hennessy
2,197 PointsRaph Hennessy
2,197 PointsThank you! It works now :)