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

Hussein Amr
Hussein Amr
2,461 Points

This is the first step

I think it's a problem with passing the agrument

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.
teachers = {'Kenneth': ['Python Basics', 'Python Collections'], 'Andrew': ['jQuery Basics', 'Node.js Basics']}

def num_teachers(**dict):
    return len(teachers)


num_teachers(teachers)

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

Close! But you should be passing in a dictionary "teachers" in the function definition rather than **dict (variable number of arguments), you'll do these later in Python courses but typically we name it **kwargs to keep your intention clear to readers of your code.

Try this:

def num_teachers(teachers):
    return len(teachers)

Good luck with Python, you're gonna love it!