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

What does this mean?

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

def numbers(fivenumbers):
    return(re.search(r'/d' * 5, fivenumbers))
#It says: numbers() takes 1 positional argument but 2 were given

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

Hey Evan Mnatsekanov, the second task says "Now, write a function named numbers() that takes two arguments: a count as an integer and a string.". Your function numbers() only takes one argument. When the task checker runs, it provides two arguments, but only one is allowed by your code. This causes the error that you see.

It is your function that is not accepting the second argument. Please updated your numbers() function to accept a count as well as a string as the two arguments.

Post back if you need more help. Good luck!!

How do I do that?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,441 Points

In three steps:

  • add a count parameter to the function signature line:
def numbers(count, fivenumbers):
  • use the count to define the repeated number
    return(re.search(r'\d' * count, fivenumbers))
  • notice that the typo / has been replaced with **

Post back if you need more help. Good luck!!!