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 trialJenny Aloma
iOS Development Techdegree Student 3,206 Pointspython unhashable type list means what ??
I think i missed something, but i can not see that. so help me please
# 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.
def most_classes(a):
kkey = ""
maxc = 0
for i in a:
if len(a[i]) > maxc:
maxc = len(a[i])
for i in a:
if len(a[i]) == maxc:
return i
def num_teachers(a):
tnt = 0
tea = []
for i in a:
if i not in tea:
tea.append(i)
tnt += 1
return tnt
def stats(a):
dd = {}
for i in a:
dd[i] = len(a[i])
return dd
1 Answer
jacinator
11,936 PointsYour only issue is that you have dd
as a dictionary when it is expecting a list of lists.
def stats(a):
dd = []
for i in a:
dd.append([i, len(a[i])])
return dd