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 Escapes

Evan Mnatsekanov
Evan Mnatsekanov
1,761 Points

whats wrong here

escapes.py
import re
def first_number(number):
    return(re.search(r'\d', number))

def numbers(fivenumbers):
    return(re.search(r'/d' * 5, fivenumbers))

2 Answers

Javi Caballero
Javi Caballero
5,295 Points

I copied and pasted your code into the challenge and it worked just fine for me, maybe try entering it in again?

Evan Mnatsekanov
Evan Mnatsekanov
1,761 Points

it says "numbers() takes 1 positional argument but 2 were given"

Steven Parker
Steven Parker
217,519 Points

The instructions for task 2 say to write a function "that takes two arguments: a count as an integer and a string", but this code takes only one argument and forces the count to always be 5.

Also, the escape character is a backslash, so the regex for a digit would be "\d" (as you used in task 1) instead of "/d".