## 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.

# most_courses should return the name of the teacher with the most courses.

I keep getting the wrong teacher, what am I missing.

Thanks,

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(teachers):
count = 0
for teacher in teachers:
count += 1
return count

def num_courses(teachers):
total = 0
for value in teachers.values():

for course in value:
total += 1

def courses(teachers):
list = []
for course in teachers.values():
list.extend(course)

return list

def most_courses(teachers):
max_count = 0
for value in teachers.values():
for course in value:
max_count += 1
return max_count
```

The `most_courses` function that you have there has exactly the same code as the `num_courses` function above it, so it's doing exactly the same thing—counting up the total number of courses that are taught. If you want the name of the teacher who teaches the most courses, you need to compare the number of courses for each one. If you use a `for teacher in teachers:` loop, each `teacher` will be the value for that teacher—the list of their courses—and you can use the `len()` function to check how many they teach. Like, for the example that they show, `len(teachers['Andrew Chalkley'])` and `len(teachers['Kenneth Love'])` would both be `2`.