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 trialEvan Mnatsekanov
1,785 PointsWhat does this mean?
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
Treehouse Moderator 68,457 PointsHey 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!!
Evan Mnatsekanov
1,785 PointsEvan Mnatsekanov
1,785 PointsHow do I do that?
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsIn three steps:
count
parameter to the function signature line:def numbers(count, fivenumbers):
count
to define the repeated numberreturn(re.search(r'\d' * count, fivenumbers))
Post back if you need more help. Good luck!!!