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 trialStheven Cabral
Full Stack JavaScript Techdegree Graduate 29,854 PointsConfused with "count numbers in the string"
In challenge task 2 of 2, what is the question asking for when it says "return an re.search for exactly count numbers in the string"? I'm not to sure what the question is asking me to do.
import re
def first_number(input_string):
return re.search(r'\d', input_string)
def numbers(integ, strg):
return re.search(r'integ', strg)
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThe question is asking to create a function that takes some integer count and a string. Check to see if there are any number sequences of count
digits long. Digits can be test for using \d.
For example, given the input 3 and "this89string123has1stringof3characters", the function should return a search result of "123"
Post back if you need more help. Good Luck!!