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 trialNafeez Quraishi
12,416 PointsPython Collection teachers.py
For Task 1, i did below and task passed
def num_teachers(teachers_dictionary):
return len(teachers_dictionary)
For Task 2, i submitted below and i got an error saying task 1 is no longer passing. I went to the Task 1 again and it was still passing. How to come out of this error ?
def num_teachers(teachers_dictionary):
course_count = 0
for item in teachers_dictionary.values():
course_count = course_count + len(item)
print(course_count)
return course_count
2 Answers
Nafeez Quraishi
12,416 PointsGot it working! Task 2 submission seems should have Task 1 function as well. Once added Task 1 code as well to Task 2, it passed.
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 PointsGood day, the instructions say: Create a new function named num_courses
So leave your function num_teachers as it is, and do part two in a new function called num_courses.
Nafeez Quraishi
12,416 PointsHave a Good day to you too.
Ohh, i missed this. But, even after changing the function name for task 2 to num_courses, i am getting same error that task 1 no longer passing.
Earlier also i have written function name wrongly but usually the error was some like function xyz not found.