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 First Sets

Can you help me get rid of this syntax error? I can't seem to get rid of it!

I just can't seem to get rid of this syntax error. Can one of you guys check my code to see if it's good?

sets.py
def songs = ('songs')
songs = {'Song1', 'Song2', 'Song3'}
    set(['songs'])

3 Answers

Thomas McDonnell
Thomas McDonnell
8,212 Points

Hi Kevin I am not sure what it is you are doing here, I have viewed the challenge and the below is the step by step walk through of how it should be solved.

Hope this helps.

"""
First make the variable songs = to the set {"song1", "song2", "song3"} 
"""
songs = {"song1", "song2", "song3"}
"""
Than use the add() funtion to add the song "Treehouse Hula" to the songs set 
"""
songs.add("Treehouse Hula")
"""
Than use the update() function to update your set with the following two sets {"Python Two-Step", "Ruby Rhumba"}{"My PDF Files"}
"""
songs.update({"Python Two-Step", "Ruby Rhumba"}{"My PDF Files"})
Steven Parker
Steven Parker
229,732 Points

When posting code, use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or watch this video on code formatting.

Steven Parker
Steven Parker
229,732 Points

It looks like you're working on task 1, but only line 2 relates to the task 1 instructions. The other lines aren't needed, and also cause a syntax error.

Thomas McDonnell
Thomas McDonnell
8,212 Points

Ops sorry I have an awful habit of forgetting about mark down.

Steven Parker
Steven Parker
229,732 Points

You can always edit your answer. :wink:

Just make a change like this

songs.update({"Python Two-Step", "Ruby Rhumba"}, {"My PDF Files"})