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 Introducing Tuples Getting to Know Tuples Creating Tuples

Assertion Error...

Hello, can you please tell me why my code doesn't work?

create_tuple.py
# insert your code here
my_tuple='I','love','python'

Traceback (most recent call last): File "", line 22, in test_code_expectations AssertionError: Regex didn't match: 'my_tuple\s=\s[/(]?\\'?\"?I\"?\\'?,\s\\'?\"?love\"?\\'?,\s\\'?\"?python\"?\\'?[/)]?' not found in "my_tuple=('I','love','python',)" : To create a tuple, my_tuple should be equal to comma separated values. You can also use parentheses around the values if you want.

1 Answer

boi
boi
14,241 Points

Ah, the good ol regex. Seems like to check your solution regex is used in the back. You'll learn about regex soon.

Coming to the error displayed *AssertionError: Regex didn't match: 'my_tuple\s=\s[/(]?\'?\"?I\"?\'?,\s\'?\"?love\"?\'?,\s\'?\"?python\"?\'?[/)]?' *.

notice that my_tuple have \s before and after the equals sign, \s means space, so try this;

my_tuple = 'I', 'love', 'python'

Give a space before, after the equals sign, and after every comma.

Oh yes, thank you so much, it worked!