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 trialDarrell Robinson
5,938 PointsNot clear on the instructions Now, write a function named numbers() that takes two arguments
I little confused on the instructions
import re
def first_number(str):
return re.search(r'\d', str)
def numbers(i,str):
return re.match(r'\W * int(i)',str)
1 Answer
Thomas Kirk
5,246 PointsHi,
You need to replace the number 1, with a variable, like count, in your code. Also, the * count section of the code needs to be outside the quotes.
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherAnd
\W
matches things that aren't word characters. Handy, but it'll also match punctuation, spaces, and anything else that isn't a number. I bet that pattern would be better served with\d
.