Objective
Create a Python program that extracts all the numbers from a text and adds them up, using re.findall.
Instructions
- Read a line of text.
- Get the list of all the groups of digits with
re.findall(r"\d+", text). - If there are none, show only
None. - If there are some, show
Numbers: n1 n2 ...on the first line, in the order in which they appear, andSum: Son the second.
Compré 3 manzanas y 12 peras por 7 euros
Numbers: 3 12 7
Sum: 22
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise