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 trial

Python Python Collections (2016, retired 2019) Sets Set Math

Create a new function named covers_all that takes a single set as an argument. Return the names of all of the courses, i

Got covers_all to work in my python IDE however it won't pass in Treehouse. What am I doing wrong?

sets.py
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(arg):
    hold = []
    for key, value in COURSES.items():
        if value & arg:
            hold.append(key)
    return hold

def covers_all(set1):
    empty_list = []
    for key, value in COURSES.items():
        if set1.issubset(value):
        empty_list.append(key)
    return empty_list

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

Hey Amanda,

You've got it - just check your indentation for your if statement.

Cheers :beers:

-Greg