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!

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 trial

Python Python Collections (2016, retired 2019) Dictionaries Teacher Stats

Prince Canty
Prince Canty
2,135 Points

code works in idle but still says wrong

can some one please explain is it a stupid misspell or something

teachers.py
# 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(thouseteach):
    staff=0
    for key in thouseteach.keys():
        staff +=1
    return int(staff)
def num_courses(thouseteach):
    course = 0
    for value in thouseteach.values():
        for item in value:
            course += 1              
    return courses
def courses(thouseteach):
    course_titles =[]
    for value in thouseteach.values():
        for item in value:
            if item not in course_titles:
                course_titles.append(item)
            else:
                continue
    return course_titles
Prince Canty
Prince Canty
2,135 Points

it wants to pass dict thru and return all values (course names) ONLY as one list

2 Answers

Prince Canty
Prince Canty
2,135 Points

Oh sorry I fixed it right after I made the post