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) Dictionaries Teacher Stats

Daniel Whiteman
seal-mask
.a{fill-rule:evenodd;}techdegree
Daniel Whiteman
Full Stack JavaScript Techdegree Student 19,248 Points

While I have the answer, I don't understand how this has anything to do with a dictionary

Sorry for asking a stupid question here. I have added the correct answer but I don't see how the answer relates to a dictionary in any way? For instance, we haven't used the {} command or even the less convenient dict([["", ""]]) command. What's throwing me is that I'm trying to incorporate a dictionary using what we learned in this section when I a basic function is what's needed. Getting tripped up on the language of the question maybe.

I realize this is all part of learning as I am a newbie. This part of the challenge is just confusing to me so in an effort to understand, I'd love some feedback. Thanks for the help!

teachers.py
# The dictionary will look something like:
# {'Andrew Chalkley': ['jQuery Basics', 'Node.js Basics'],
#  'Kenneth Love': ['Python Basics', 'Python Collections']}
#
# Each key will be a Teacher and the value will be a list of courses.
#
# Your code goes below here.
def num_teachers(arg):
    return len(arg)
angel moreta
angel moreta
2,912 Points

hint: remember that your are getting a dictionary as a parameter, they asked you for the total of TEACHERS and also think about the keys() function.

Daniel Whiteman
seal-mask
.a{fill-rule:evenodd;}techdegree
Daniel Whiteman
Full Stack JavaScript Techdegree Student 19,248 Points

Thanks Angel! I'll remember the hint as I move ahead. It was the initial reference to the dictionary that threw me, made me feel like I was missing something. Thanks for the help!

1 Answer