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 trialleonard jurado
12,445 Pointsset Math task 1/2
Hi guys,
I'm at task 1/2 of Set Math. This is currently the code I prepared. It works alright in the launcher but the test does not accept it.
def covers (topic):
set1=set([])
result = 0
for key in COURSES.keys():
if topic in COURSES[key]:
result = key
set1.add(result)
else:
continue
return(set1)
What am I doing wrong?
Thanks
1 Answer
Oli Flemmer
13,394 PointsI think you have gotten the wrong idea of what to do here. The challenge wants you to find every course that intersects with the topic given. You can picture the topic supplied as being a set with just one item and you have to compare that set to all the other courses (sets as well) to find which ones intersect and then return those.
If you are still struggling after reading this let me know and I'll give you my code.