Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
str.split and str.isdigit solution in Clear category for Sum Numbers by jbwb
def sum_numbers(text: str) -> int:
"""From a given string, returns the sum of all independent integers
present."""
list_of_potential_integers = text.split(" ")
sum = 0
for word in list_of_potential_integers:
if word.isdigit():
sum += int(word)
return sum
April 1, 2020
Comments: