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 trialmamadou diene
Python Web Development Techdegree Student 1,971 PointsWow, I just can't stump you! OK, two more to go. I think this one's my favorite, though. Create a function named most_c
i need pointers on this one. please
# 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):
teacher_count = 0
for teacher in teachers:
teacher_count +=1
return teacher_count
def num_courses(teachers):
total_courses = 0
for value in teachers.values():
for course in value:
total_courses +=1
return total_courses
def courses(teachers):
total_courses = []
for value in teachers.values():
total_courses += value
return total_courses
def most_courses(teachers):
max_courses = 0
bestteacher = ""
for key,value in teachers.item():
if len(values)> max_courses:
max_course = len(value)
bestteacher = teacher
return bestteacher
1 Answer
Steven Parker
231,236 PointsThe logic looks good , but you have some mixed terms and/or spelling issues:
- "item" instead of "items"
- "values" instead of "value"
- "teacher" instead of "key"
Fix those and you should pass.