Python Python Collections Sets Set Math

David Chacón
David Chacón
1,070 Points

Sets baby

Hey guys,

This one is really confusing me. I've included two different sets of code I believe are either close or should work. They don't though... so... a little push in the right direction would be great!! Thanks!
    "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(subject):
    subjectList = []
    for keys, values in COURSES.items():
        if subject.intersection(values)

    return subjecList


def covers(subject):
    subjectList = []
    for keys in COURSES.items():
        for values in COURSES[i]:
            if subject.intersection(COURSES[i])

    return subjecList

1 Answer

Jason Anello
Jason Anello
Treehouse Moderator 91,186 Points

Hi David,

Your first solution is correct with the exception of a syntax error and typo.

Your if statement needs a colon at the end.

In your return statement, you were missing the 't' in subjectList.