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.

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 !