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
I don't really know how to do this one
I have attempted to find all numbers and ignore only 5, 6, and 7 however the code finds all numbers and includes 5,6, and 7
import re string = '1234567890' good_numbers = re.findall(r'\d*[^567]', string)
Stuart Wright41,117 Points
Your regular expression reads:
"Match any number of digits, followed by one character that is not 5, 6 or 7."
This should do what the challenge is asking, which is match any number of characters except 5, 6 or 7 :
import re string = '1234567890' good_numbers = re.findall(r'[^567]*', string)
Tri Pham18,671 Points
I didn't like the way the question was phrased. I thought they should have added the expected result. The expected result is actually ['1', '2', '3', '4', '8', '9', '0']. Yours got ['1234567890']. Can you solve it now?