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
Christian Rowden
2,278 Pointssets.py, TypeError unhashable set
I'm having a moment of frustration here. It looks like my code should be close to the mark but what I'm finding is that whenever I try to intersect my set2 with the function argument (arg) I get this error that states that (arg) isn't hashable which I don't understand. Can anyone point me in the right direction please?
Thank you very much Christian
''' COURSES = { "Python Basics": {"Python", "functions", "variables", "booleans", "integers", "floats", "arrays", "strings", "exceptions", "conditions", "input", "loops"}, "Java Basics": {"Java", "strings", "variables", "input", "exceptions", "integers", "booleans", "loops"}, "PHP Basics": {"PHP", "variables", "conditions", "integers", "floats", "strings", "booleans", "HTML"}, "Ruby Basics": {"Ruby", "strings", "floats", "integers", "conditions", "functions", "input"} }
def covers(arg): mlist = [] set2 = COURSES.items() mlist.append(arg.intersection(set2)) print(mlist)
covers({'Python'})
"""