Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
215,958 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
215,958 PointsSteven Parker
215,958 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!