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 trialoliverchou
20,886 PointsWhy is there a SyntaxError?
def stats(dict_tea):
li = []
for key in dict_tea:
add = [key, len[dict_tea[key]]
li.append(add)
return li
And here's the code that I tested the function.
test_dict = {'Jason Seifer': ['Ruby Foundations', 'Ruby on Rails Forms', 'Technology Foundations'],
'Kenneth Love': ['Python Basics', 'Python Collections']}
print (stats(test_dict))
I can't figure out why it kept giving me an SyntaxError at the "li.append()"? Any idea about that?
oliverchou
20,886 PointsOh, I was dizzy! Anyway, thanks! :)
Cheo R
37,150 PointsCheo R
37,150 PointsYour error is not at
li.append()
but at
[key, len[dict_tea[key]]
Can you see the syntax error.