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 trialHolden Glass
6,077 PointsDon't understand what to do.
I know what the program wants me to do but I don't understand how to do it.
# You can check for dictionary membership using the
# "key in dict" syntax from lists.
### Example
# my_dict = {'apples': 1, 'bananas': 2, 'coconuts': 3}
# my_list = ['apples', 'coconuts', 'grapes', 'strawberries']
# members(my_dict, my_list) => 2
def members(d, k):
2 Answers
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsHi Holden Glass
Just be aware that this challenge is part of the Retired Python Collections. And that there is a New Python Collections
For the challenge you are working on here. Kenneth gave you a HINT that you will be using the in keyword to check a list/dict for membership ( aka check if an item is IN another list).
Basically, you will write a function with 2 parameters. First parameter will end up holding a dictionary (key/value pairs), and the second parameter will hold a List of just keys. You will have to find a way to hint hint iterate through your list of keys and see if they are IN your Dict list of keys. Making sure you are keeping a running count of them, and make sure you return that count.
Let me know if that helps?
Omid Ashtari
4,813 Pointshey Holden Glass, how come the new 'collections' is not placed in the Python track instead of the retired version? any advantages to doing the old version vs. the new one? or just skip to the new collections track?
Omid Ashtari
4,813 Pointsugh, sorry, I meant to ask Chris Howell
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsI think its because they scheduled retiring of Python Collections v1 for Jan 31st 2017.
I would assume that Python Collections v2 will replace it on that date.
This probably gives the instructor time to work out any kinks in the challenge/quizzes before it becomes the final replacement in the Track.
Though these are only assumptions, they may have a better reason for not immediately replacing it. :)
Holden Glass
6,077 Pointsit means I have 29 days to complete the track!
Holden Glass
6,077 PointsHolden Glass
6,077 PointsYes thank you. I have a much better Idea on what to do now.