Welcome to the Treehouse Community
Looking to learn something new?
Sean ClaytonCourses Plus Student 1,029 Points
Something wrong with courses code?
my function courses isn't returning what I want. Or, should I say, I think it should return the correct answer.
From my view - I have the correct function, I created an empty list and created a for loop which found the values and appended the list. Finally I returned the total number correctly(I think!)
Guidance would be appreciated
def num_teachers(teachers): total_teachers = list(teachers.keys()) return(len(total_teachers)) def num_courses(teachers): total_courses = (sum(map(len, teachers.values()))) return(total_courses) def courses(teachers): total_courses =  for number in teachers.values(): total_courses.extend(number) return total_courses
Did you by any chance mix spaces and tabs? Or copy and paste? I think that can cause a problem sometimes.
At the moment, the function returns a list of all the values of whatever dictionary is passed in, so assuming assuming you feed it with the challenge dictionary:
['jQuery Basics', 'Node.js Basics', 'Python Basics', 'Python Collections']
You say that it's not returning what you want, what were you expecting the output to be?
Awesome! Glad that worked :)