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 trialJason Smith
8,668 PointsBummer: `good_numbers` seems to be missing or empty.
im not sure where i messed up, can you point me in the right direction?
import re
string = '1234567890'
good_numbers = re.findall(r'[0-4][^5-7][8-9]', string)
3 Answers
Steven Parker
231,275 PointsIt looks like you got a bit overly-specific, and each of your character classes represent a different character.
A regex of '[0-4][^5-7][8-9]'
will only match 3 consecutive characters where the first one is a digit between 0 and 4 (inclusive), the second one is anything other than 5, 6, or 7, and the last one is either 8 or 9. And of course, there are no instances like that in the test string.
Try making a bit simpler, specify only the requirements, and for a single character.
Jason Smith
8,668 Pointsi was under the impression multiple sets meant multiple queries, can you give me an example of a similar one-set query?
Jason Smith
8,668 Pointsthanks for the hint! that was it
Steven Parker
231,275 PointsSteven Parker
231,275 PointsThe instructions say the "pattern matches anything in
string
except the numbers 5, 6, and 7.", so you really only want to use a single character class, and use it to only exclude those three digits. So you already have the right coding, but it's sandwiched between two other things you don't need.