Objective
Create a Python program that finds the first number that appears in a text using a regular expression.
Instructions
- Import the
remodule. - Read a line of text.
- Search for the first group of digits with
re.search(r"\d+", text). - If you find it, show the number (
.group()). If there are no digits, showNo numbers.
Tengo 3 gatos y 12 peces
3
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise