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 trialDiego Salas Polar
21,431 PointsPlease help me with this.
I am getting this error, 'Oops! It looks like Task 3 is no longer passing.' for the past two hour. I need help.
# 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(string):
return len(string)
def num_courses(teacher):
total = 0
for value in teacher.values():
for val in value:
total += 1
return total
def most_courses(dict):
max_classes = 0
for teacher in dict:
classes = len(dict[teacher])
if(classes>max_classes):
max_classes = classes
most_classes = teacher
return most_classes
2 Answers
Mike Wagner
23,559 PointsIt looks like you finished task 3 and at a later step removed the courses
function. If you reimplement it like you had before, you should be back on track
james south
Front End Web Development Techdegree Graduate 33,271 Pointsthis line
most_classes = teacher
needs to be tabbed over once so it's in the if block, not under it. when it's under the if, most_classes will just be set to the last teacher in the loop through the dict keys, not necessarily the teacher with the most classes.