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 trialEn-Wei Wright
Data Analysis Techdegree Graduate 8,796 PointsExample_2 and Example_3 in the exercise code
I think in the exercise code provided, example_2 and example_3 are missing the parentheses around the members in the set being compared to ({A, E, I, U} instead of {'A', 'E', 'I', 'U'})
1 Answer
Chris Freeman
Treehouse Moderator 68,453 PointsHey En-Wei Wright, Can you expand on what you mean about the parentheses?
The curly brackets or braces { } define the set. A comma is used to separate the set elements. Any parens within the set definition would serve to define some element, such as a tuple, within the set. Any parens outside the set would serve to define the set itself as an element of a larger collection, or allow the set definition to span multiple lines.
In the later case, the parens are not part of the set definition but rather are part of the grouping syntax that allows for better readability:
# standard syntax
>>> s = {0, 1, 2, 3}
>>> s
{0, 1, 2, 3}
# grouping syntax
>>> s = ({0, 1,
2, 3})
>>> s
{0, 1, 2, 3}
# unnecessary grouping parens
# ignored by parser
>>> s = ({0, 1, 2, 3})
>>> s
{0, 1, 2, 3}
Post back if you need more help. Good luck!!!
En-Wei Wright
Data Analysis Techdegree Graduate 8,796 PointsEn-Wei Wright
Data Analysis Techdegree Graduate 8,796 Pointsoof I meant quotation marks! Sorry about that. Thank you for your answer though! I think I got it