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 trial

Python Regular Expressions in Python Introduction to Regular Expressions Negated Numbers

Chih-Wei Hsu
Chih-Wei Hsu
11,132 Points

negate numbers challenge

Help, please. I don't know what's wrong with my code here that wouldn't pass the code challenge. Thanks!

import re

string = '1234567890'

def good_numbers(string): return re.findall(r'[^567]', string)

2 Answers

Dario Tordoni
Dario Tordoni
9,635 Points

Hi Chih-Wei Hsu, the logic of your code seems good to me. If I am not in wrong the challenge ask you to set up a variable, not a function; try to write your code again using a variable instead of a function.

good_numbers = your code here
Chih-Wei Hsu
Chih-Wei Hsu
11,132 Points

yes, lol. i didn't read carefully the instruction. thanks !