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

seong lee
seong lee
4,503 Points

PLEASE HELP! I'm in a struggle here please help.

I am not understanding why it keeps saying "please try again". Thank you in advance!

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(topics):
    listing = []
    for thing in COURSES.items():
        a, b = thing
        if topics.intersection(b) :
            listing.append(a)
    return listing    
}

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Look like you have an extra trailing curly bracket at the bottom of your code.

Post back if you need more help. Good luck!!

seong lee
seong lee
4,503 Points

that wasn't the problem I tried but it did not work

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

If I literally cut-and-paste your above code:

def covers(topics):
    listing = []
    for thing in COURSES.items():
        a, b = thing
        if topics.intersection(b) :
            listing.append(a)
    return listing    

It passes Task 1. It doesn't look like you've started on Task 2 yet.

seong lee
seong lee
4,503 Points

I did the exact same thing but it did not work with the other code on top