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!
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
Olivia Cooksey3,516 Points
Create a variable names that is an re.match() against string. The pattern should provide two groups, one for a last name
Create a variable names that is an re.match() against string. The pattern should provide two groups, one for a last name match and one for a first name match. The name parts are separated by a comma and a space.
Bummer: SyntaxError: re.match() = names ('Perotto, Pier Giorgio')
names.py ) 1 import re 2 3 string = 'Perotto, Pier Giorgio' 4 re.match() = names ('Perotto, Pier Giorgio')
import re string = 'Perotto, Pier Giorgio' re.match() = names ('Perotto, Pier Giorgio')
Steven Parker227,126 Points
You were closer in your previous question, take a look at it again and the hints I gave for it.
Here, the variable name and function are both on the wrong side of the assignment. And in both this sample and the previous one, you need a pattern which will identify two groups (using parentheses) and also identify the characters to include in each group along with those that will separate them.
You might want to review the video on Groups and look at the grouping patterns shown in the examples.
Extra hint: it's not necessary to name the groups in this challenge.