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 trialMatthew Schwer
Python Web Development Techdegree Student 975 PointsNot recognizing my function at all. It says "Bummer: Couldn't find `most_courses`"
I'll work on it in workspaces or Anaconda tomorrow but I am curious if it is some bug or if I am missing something blatant due to my persistent lack of sleep.
Thanks in advance!
Matthew
# 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(treehouse_teachers):
return len(treehouse_teachers)
def num_courses(treehouse_teachers):
return sum(len(v) for v in treehouse_teachers.values())
def courses(treehouse_teachers):
course_list = []
for value in treehouse_teachers.values():
course_list += value
return course_list
def most_courses(treehouse_teachers):
highest_num = 0
teacher_most_classes = ""
for key, value in treehouse_teachers.items():
if len(value) > highest_num:
highest_num = len(value)
teacher_most_classes = key
return tearcher_most_classes
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Matthew Schwer ! You're actually doing fantastic! The reason you're getting this rather cryptic answer is that you're returning a value that isn't defined. I know that sounds odd because it looks like it is defined, right? Take another look.
You wrote:
return tearcher_most_classes
But you meant to write:
return teacher_most_classes
Note the spelling difference between "teacher" and "tearcher". Just a typo! When I correct the typo (the extraneous "r"), your code passes with flying colors!
Hope this helps!
Matthew Schwer
Python Web Development Techdegree Student 975 PointsMatthew Schwer
Python Web Development Techdegree Student 975 Pointssilly me and my dyslexia! Thank you for taking the time to respond!