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 trialrodian
3,637 PointsQuick question about the Combo Challenge
After spending a good amount of time I was successfully able to solve the Challenge using the zip function. However, I don't remember ever covering the zip function in the video lectures. So I am left wondering if there was another intended solution that I was supposed to use. Thanks for the help in advance.
2 Answers
rodian
3,637 PointsGreat, I tried something very similar to that but I think I wrote something closer to "for i in a:" I thought Python steps through the lists using the index number, but my version was too specific to one variable. I can see how the version you used made i into a number that was independent of either variable. Thanks for the help.
Steven Parker
231,269 PointsUsing zip was clever and a good application of research. I'm glad it passed the challenge, sometimes only the expected method will pass even if others work.
If I recall correctly, my solution (not being aware of zip at the time) was something like this:
SPOILER ALERT
def combo(a, b):
newlist = [];
for i in range(len(a)):
newlist.append((a[i], b[i]))
return newlist