← Back to challenges

Grab the Numbers

PythonHardstringsnumbers

Instructions

Given a string including a bunch of characters and numbers, return the sum of all the numbers in the string. Note that multiple digits next to each other are counted as a whole number rather than separate digits.

Examples

grab_number_sum("aeiou250abc10") ➞ 260

grab_number_sum("one1two2twenty20") ➞ 23

grab_number_sum("900uwu50uwuuwuuwu25uwu25") ➞ 1000

Notes

Remember not to just add single digit numbers together, it should be possible for answers to easily get into the 100s!

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.