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 Escapes

hugo dahl
hugo dahl
2,967 Points

whats wrong?

e

escapes.py
import re

def numbers(count, input_string):
    pattern = r"\d" * count
    match = re.search(pattern, input_string)
    return match

count = 3
input_string = "abc123def456ghi789"
result = numbers(count, input_string)

if result:
    print(f"Found {count} numbers: {result.group()}")
else:
    print(f"No match found for {count} numbers.")
first_number = 42

1 Answer

Steven Parker
Steven Parker
231,198 Points

It appears that you overlooked the part of the instructions that say "Important: In each task of this code challenge, the code you write should be added to the code from the previous task."

The function "first_number" written for task 1 should still be there, but it seems to have been removed.