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
Yaron Wainberg4,426 Points
create a function named stats...
i set the function to :
def stats(teacher): for key in teacher: return key, len(teacher[key])
in my computer i run it as single command and got the desired results of a list of teachers and number of classess
why isn't it working on the workspace ?
Chris Bennett7,499 Points
Not sure how it worked on your computer I couldn't get it to work in my terminal.
the code below works in both though (just put your code on multiple lines with proper indentation)
def stats(teacher): for key in teacher:return key, len(teacher[key]) #This works too def stats(teacher): for key in teacher: return key, len(teacher[key])