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 trialVuk Spasojevic
9,491 PointsWhat I am doing wrong. Please help
Code returns list of all courses but check return Bummer Couldn't find 'courses'. Yet function is named courses as requested
# 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(dict):
num_teachers = 0
for teacher in dict:
num_teachers += 1
return num_teachers
def num_courses(dict):
num_courses = 0
for teacher in dict:
num_courses += len(dict[teacher])
return num_courses
def courses(dict):
courses_list = []
for teacher in dict:
for course in dict[teacher]:
courses_list.append(course)
return course_list
Peter Smart
9,150 PointsI'm still super new at this, but should return course_list be return courses_list?
2 Answers
chrisarasin
4,614 PointsYour list name is "courses_list" but you're returning "course_list" without an s on courses.
Steve Hunter
57,712 PointsGood spot!
Vuk Spasojevic
9,491 PointsAnd officially I am super idiot. Thank you all for help.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsHi there,
It'll say "couldn't find 'courses'" if the code won't run due to a syntax error.
I'll have a look and see what I can help you with.
Steve.