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 trialMarshall Livingston
Python Web Development Techdegree Student 2,763 PointsDict inquiry on 5 step quiz
not sure where i am going wrong. please take a look.
def num_teachers(teachers_courses): return len(teachers_courses)
def num_courses(teachers_courses): return sum(len(v) for v in teachers_courses.values())
def courses(teachers_courses): single_list = [] for courses in teachers_courses.values(): single_list += courses
return single_list
# 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(teachers_courses):
return len(teachers_courses)
def num_courses(teachers_courses):
return sum(len(v) for v in teachers_courses.values())
def courses(teachers_courses):
single_list = []
for single_list in teachers_courses.values():
single_list += courses
return single_list
1 Answer
Marshall Livingston
Python Web Development Techdegree Student 2,763 Pointsi got it!
def num_teachers(teachers_courses):
return len(teachers_courses)
def num_courses(teachers_courses):
return sum(len(v) for v in teachers_courses.values())
def courses(teachers_courses):
single_list = []
for courses in teachers_courses.values():
for course in total_course:
single_list.extend(course)
return single_list
Jostein Dyrseth
9,388 PointsJostein Dyrseth
9,388 PointsGreat! I'm at the exact same place as you btw :)
Herman Brummer
6,414 PointsHerman Brummer
6,414 Points