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 trialReynaldo Ponte
669 Pointshi guys,I am returning 5 when i should return 18 courses. It passes in IDEL 3.xx but not here.
hi guys. i got to the last part of the challenge fine but the treehouse shell keeps telling me that I am returning 5 when i should return 18 courses. I ran it IDEL 3.xx it worked fine can you guys help and tell me where i went wrong. thanks so much for your help
this is my code so far.
case={'Jason Seifer': ['Ruby Foundations', 'Ruby on Rails Forms', 'Technology Foundations'],
'Kenneth Love': ['Python Basics', 'Python Collections']}
def most_classes(case):
maax=0
teacher=[]
for teach in case:
if len(case[teach])>= maax:
maax=len(case[teach])
teacher=teach
return teacher
def num_teachers(case):
Teachers=len(case)
return Teachers
def stats(case):
lst=[]
for teach in case:
lst.append([teach,len(case[teach])])
return lst
def courses (case):
cour=[]
for items in case:
cour.append([items,case[items]])
return cour
3 Answers
Kenneth Love
Treehouse Guest TeacherThe example dictionary shown at the top of the script is just that, an example. The actual dictionary passed to your code in the challenge is much bigger. There really are 18 courses in it :)
Your courses
function's append
statement is a little weird. Why are you appending a list into the returned list? You should be extending the returned list with the contents of each teacher's course list (their key's value).
Ryan Carson
23,287 PointsI actually think your code is correct and maybe there's a problem with this Code Challenge. Based on the Dictionary
teachers = {'Jason Seifer': ['Ruby Foundations', 'Ruby on Rails Forms', 'Technology Foundations'], '@[Kenneth Love](https://teamtreehouse.com/kennethlove)': ['Python Basics', 'Python Collections']}
it should return 5
not 18
Kenneth Love, can you please help?
Reynaldo Ponte
669 Pointshi Ryan thanks i hope so. ( I mean i hope my code is correct)
Reynaldo Ponte
669 PointsReynaldo Ponte
669 PointsHi kenneth, thanks for you help. well appreciated. I will updated my function the soonest.