Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
simple, easy to read solution in Clear category for Sum Numbers by courtneywalsh05
def sum_numbers(text: str) -> int:
return sum(
int(n)
for n in text.split()
if n.isdigit()
)
if __name__ == '__main__':
print("Example:")
print(sum_numbers('hi'))
# These "asserts" are used for self-checking and not for an auto-testing
assert sum_numbers('hi') == 0
assert sum_numbers('who is 1st here') == 0
assert sum_numbers('my numbers is 2') == 2
assert cc
assert sum_numbers('5 plus 6 is') == 11
assert sum_numbers('') == 0
print("Coding complete? Click 'Check' to earn cool rewards!")
May 5, 2020
Comments: