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 trialjruss16
6,509 Pointsnames.py Having trouble solving this problem
import re
string = 'Perotto, Pier Giorgio'
names = re.match(''' (?P<first>\w+,){1} # Last name (?P<last>\s\w+) ''', string, re.X)
Not sure why I'm not passing this quiz based on my code...
import re
string = 'Perotto, Pier Giorgio'
names = re.match('''
''', string, re.X)
1 Answer
Steven Parker
231,122 PointsA comma and space should be recognized as separating the names, but the comma should not be included as part of the last name.
The first name will possibly contain word characters and spaces, so the match should use a character class that accepts both of these ("[\s\w]" in brackets).
And while the challenge won't look at your group names, it's the last name that will be first in the string.
jruss16
6,509 Pointsjruss16
6,509 PointsI got it. thank u!