• Do not sum in string "who is 1st here"

Question related to mission Sum Numbers

 

Hello,

what can I do better or what should I use? I try to resolve this problem but I have problem with string "who is 1st here" - how to not sum "1st"?

I have two solutions.

First:

def sum_numbers(text: str) -> int:

     return sum(map(int,re.findall('\d+',text)))

Second:

def sum_numbers(text :str) -> int:
        return sum(int(_) for _ in text if _.isdigit())
3