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 trialPrince Canty
2,135 Pointscode works in idle but still says wrong
can some one please explain is it a stupid misspell or something
# 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
2 Answers
Robert Ionut Muraru
Full Stack JavaScript Techdegree Graduate 22,194 PointsThe only issue I see is with the return courses in the num_courses function. It should return course instead of course(s). It passed the task after that.
Prince Canty
2,135 PointsOh sorry I fixed it right after I made the post
Prince Canty
2,135 PointsPrince Canty
2,135 Pointsit wants to pass dict thru and return all values (course names) ONLY as one list