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())
Created at: 2020/08/25 12:00; Updated at: 2020/08/25 13:11