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.

Sam Frampton
3,796 PointsString is not callable
Running a function name that takes a string as an argument. I get a response string is not callable. Don't understand why.
import re
first_number = '25namestest'
print(re.search(r'/d','first_number'))
2 Answers

Alexander Davison
65,468 PointsDefining a variable isn't quite what the challenge is asking for.
Try defining a function instead. Also note that you used a forward slash /
instead of a backslash \
, and that you surrounded first_number
in quotes.
Good luck!

Sam Frampton
3,796 Pointsimport re
def first_number(string):
return re.search(r"\d", string)
Here I found the solution thanks for help
Sam Frampton
3,796 PointsSam Frampton
3,796 PointsThanks for the advice: It's late here in the UK and I know I am making a stupid mistake but here is where I am stuck at and I seem to be returning the incorrect answer.
import re
def first_number(): string = '12test' return string
print(re.search(r'\d', 'first_number'))
= 'bummer incorrect answer'