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.
dylan hamm3,667 Points
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,102 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?