Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Emily Sue
1,769 Pointsteacher stats 5:5
I can't seem to figure out what's wrong with the last part of this code. can someone help me? everything else seems to pass except this last one
# 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(teach_dict):
return len(teach_dict)
def num_courses(teach_dict):
course_num = 0
for teacher in teach_dict:
for course in teach_dict[teacher]:
course_num += 1
return course_num
def courses(teach_dict):
class_list = []
for teacher in teach_dict:
for course in teach_dict[teacher]:
class_list.append(course)
return class_list
def most_courses(teach_dict):
most = 0
for teacher, courses in teach_dict.items():
if len(courses) > most:
most = len(courses)
name = teacher
return name
def stats(teach_dict):
list_of_lists = []
for teacher, courses in teach_dict.items():
single_list = [teacher, len(courses)]
list_lists.append(single_lists)
return list_of_lists
2 Answers

Nicholas Ward
5,797 PointsYour logic is totally correct, but just a small syntax error. Just change
list_lists.append(single_lists)
to
list_of_lists.append(single_list)
(fix list_of_list and remove the 's' from single_lists)

Emily Sue
1,769 Pointshmm ok. i'll try again. but yes it helps
Emily Sue
1,769 PointsEmily Sue
1,769 Pointsit says it can't find 'stats'
Nicholas Ward
5,797 PointsNicholas Ward
5,797 PointsI tested your exact code with those two changes I mentioned above, and it should pass all five challenges. Sometime the Challenge "Bummers" are not very useful for determining the actual issue. It will often say "can't find function" if there is a syntax error within the function block. Hope that helps!