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.
Mar Bocatcat7,405 Points
What am i missing here? Any advice?
import re string = '1234567890' def good_numbers(string): return re.findall(r'[\w\d][^567]', string, re.I)
Chris FreemanTreehouse Moderator 67,736 Points
There are two issues with your solution. First, the task asks only to create a variable named
good_numbers, not a function.
Second, your regex is overly complicated for the task. By combining two character sets your regex
`[any word or decimal character][not followed by 5 6 or 7]' this means the "7" will still be found "good" because it is follow by "8".
Your regex need only say `[not a 5, 6 or 7]'. This can be accomplished using:
good_numbers = re.findall(r'[^567]', string)
re.I is not needed since there is no character case to ignore.
Best of luck. Keep Coding!