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 trial

Python Python Collections (2016, retired 2019) Tuples Combo

David Chacón
David Chacón
1,086 Points

can I get a large combo.py?

Hey community, I need some assistance. Altering, creating and managing tuples is decently confusing to me. I've watched the videos a couple times and have searched StackOverflow for examples while avoiding direct solutions.

I feel like I am close again but just can't figure out what I'm missing. Would someone mind pointing me in the right direction?

combo.py
# combo([1, 2, 3], 'abc')
# Output:
# [(1, 'a'), (2, 'b'), (3, 'c')]

def combo(item1, item2):
    blankList = []
    for a,b in (item1, item2):
        blankList.append([a,b])
    return blankList

1 Answer

Without giving an explicit code example (since you asked for pointing), I can point you in two directions that will hopefully help. First, you're appending a list to the list NEW_LIST when the challenge asks for a list of tuples. Second, your loop is a little off. Since it specifies both of the iterables that the function receives are the same length, try looping through range of their indices, and accessing the items in the lists using each index.

David Chacón
David Chacón
1,086 Points

That was great pointing Xander! Took me a couple more tries but got it!