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)
![Siddesh Gannu](https://uploads.teamtreehouse.com/production/profile-photos/5635592/micro_matrix.jpg)
Siddesh Gannu
3,565 Pointscovers function not working
My code doesn't work in the editor but it works on my personal IDE. I tried changing the spaces to tabs. But it keeps telling me that it's not getting the right result for covers.
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(topic):
lst = []
for course, topics in COURSES.items():
if topic.issubset(topics):
lst.append(course)
return lst
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsIt's not your indentation. But the function should produce a list of classes where the topics overlap. By "overlap" they mean if it has any topics in common. But a subset only exists when the set has every topic in common with the other set. So this is not the right test for this function (it might be useful later, though!).
See if you can find a different method that will meet the specific needs of this function.
Siddesh Gannu
3,565 PointsSiddesh Gannu
3,565 PointsThanks, I used "if not isdisjoint(topics)" that worked for me
Steven Parker
230,688 PointsSteven Parker
230,688 PointsI assume you meant "
I don't think I've seen that method used for this before.
if not topic.isdisjoint(topics):
" — and very clever!