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 trialMartin Valov
Courses Plus Student 208 PointsWhat im doing wrong here
I tried it in my python IDLE on PC and it's giving me the answer. But here it seas 'Try Again'
# 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(dictionary):
num_teachers = 0
for name in dictionary.keys():
num_teachers += 1
return num_teachers
def num_courses(dictionary):
num_courses = 0
for courses in dictionary.values():
num_courses += len(courses)
return num_courses
def courses(dictionary):
list_courses = []
for courses in dictionary.values():
list_courses += courses
return list_courses
def moust_courses(dictionary):
# Should return the name with the most courses
the_name = ""
num_courses = 0
for name, courses in dictionary.items():
if len(courses) > num_courses:
the_name = name
num_courses = len(courses)
return the_name
2 Answers
Martin Valov
Courses Plus Student 208 PointsThank you very much for the help. I don't know why sumetimes I stumb on such obvious mistakes, I suppose it's a part from the learning. Again thanks allot ;)
KRIS NIKOLAISEN
54,971 PointsYou misspelled most here
def moust_courses
Martin Valov
Courses Plus Student 208 PointsYes i fixed it and still it's not right
KRIS NIKOLAISEN
54,971 PointsKRIS NIKOLAISEN
54,971 PointsIf I copy paste your code with that change it passes the first 4 tasks. You may need to copy your code and click restart - then paste it back in. Or close/reopen you browser. Sometimes the checker gets hung up.