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 trialEric Housman
3,758 PointsSet Python
Maybe I don't understand the questions, but here is what I have. When asked to run covers func with covers({"Python}), I get the courses that overlapped, which in this case is just Python Basics. If I pass in something such as booleans, I get all except Ruby Basics in a list. From what the questions stated, it wants a list of courses from courses if the supplied set and course value (which is a set) overlap. What am I missing here?
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(given):
course_list = []
for i in courses:
for n in courses[i]:
if given & courses[i]:
if i not in course_list:
course_list.append(i)
return course_liste
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsYou are very close. The reference dictionary is COURSES
not courses
.
Also, there's a typo in "course_liste"
Eric Housman
3,758 PointsEric Housman
3,758 PointsThat was it! I didn't realize that my IDE had made the COURSES lowercased so it worked on my end there but not on treehouse. Thanks for that!