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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Gilang Ilhami](https://secure.gravatar.com/avatar/28c2c5325f8a39d1f055a5b68761fef0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gilang Ilhami
12,045 PointsTeacher stats
The fourth step
Bummer! You returned 5 courses, you should have returned 18.
Do i have to add something here?
# The dictionary will be something like:
# {'Jason Seifer': ['Ruby Foundations', 'Ruby on Rails Forms', 'Technology Foundations'],
# 'Kenneth Love': ['Python Basics', 'Python Collections']}
#
# Often, it's a good idea to hold onto a max_count variable.
# Update it when you find a teacher with more classes than
# the current count. Better hold onto the teacher name somewhere
# too!
#
# Your code goes below here.
my_dict = {'Gilang' : ['Basic of Nuclear Technologies', 'Practical Quantum Physics', 'The Philosophy of Physics'], 'Yohannes' : ['Energy Engineering', 'Green Technology'], 'Audrey' : ['The Psychology of Patriotism']}
def most_classes(my_dict):
max_count = 0
most_class = ""
for teachers in my_dict:
if len(my_dict[teachers]) > max_count:
max_count = len(my_dict[teachers])
most_class = teachers
return most_class
def num_teachers(my_dict):
teacher = len(my_dict.keys())
return teacher
def stats(my_dict):
the_list = []
for teachers in my_dict:
new_string = [teachers, len(my_dict[teachers])]
the_list.append(new_string)
return the_list
def courses(my_dict):
single = []
for value in my_dict.values():
single.append(value)
return single
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 Points
Perhaps you meant to use extend?
The append method adds a list as a single new element, but extend adds each item from a list as a separate element.