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

need help

would like to know if anyone could let me know why my code is not passing.

thanks in advance.

# 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(dict):
    return len(dict.keys())

def num_courses(dict):
    counter = 0
    for key in dict:
        amount = len(dict[key])
        counter += amount
    return counter 

def courses(dict):
    course_list = []
    for key in dict:
    return course_list

def most_courses(dict):
    highest_number = 0
    teacher = ''
    for key in dict:
        if Len(dict[key]) > highest_number:
            teacher = key
    return teacher

Also, you assign teacher to the key, but I don't see where you are assigning the highest_number.

1 Answer

if Len(dict[key]) > highest_number: <-- you have L in len capitalized