Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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!