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 trialDaniel Cunningham
21,109 PointsChallenge 2/2: Error "Couldnt Find 'Covers'".
Code otherwise seems to work in workspaces. Anyone see the issue? Thank you!
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(param):
list = []
for a in COURSES:
if len(param.intersection(COURSES[a])) >=1:
list.append(a)
return list
def covers_all(set):
list = []
checkcase = len(set)
for a in COURSES:
if len(param.intersection(COURSES[a])) == checkcase:
list.append(a)
return list
frankgenova
Python Web Development Techdegree Student 15,616 PointsI copy paste my challenges over into an IDE and it catches Syntax. I've used a few different ones including PyCharm, Atom, Spyder and VS Code. My current favorite is PyCharm.
Ismail KOÇ
1,748 Pointsdef covers_all(arg):
courses_arg = []
for course in set(COURSES.keys()):
if len(arg & COURSES[course]) == len(arg):
courses_arg.append(course)
return courses_arg
You can check this out and see what is wrong.
1 Answer
frankgenova
Python Web Development Techdegree Student 15,616 PointsTake a look closely at your second function covers_all(). You are applying .intersection() method against param. However, you did not pass param to the function. Also notice set is in red it is a Python function so I would not name my argument set.
Jason Anello
Courses Plus Student 94,610 Pointschanged comment to answer
Daniel Cunningham
21,109 PointsThanks again for your help and the IDE recommendations! Best of luck to you!
Daniel Cunningham
21,109 PointsDaniel Cunningham
21,109 PointsGreat Catch! That worked, thank you very much! I wish they would print the output or error when the task fails so it's easier to catch syntax issues... Thanks again!