Validate decimal number

Write codeMedium30 minStripe style

Your task

Write a validator that decides whether a string is a well-formed decimal number under this grammar: an optional leading '+' or '-' sign, then a mantissa, then an optional exponent. The mantissa is either digits, or digits '.' digits, or digits '.', or '.' digits (at least one digit total). The exponent is 'e' or 'E', an optional sign, then one or more digits. No spaces are allowed. Return True if the entire string matches, else False. Examples that are valid: '0', '-3.14', '.5', '2.', '1e10', '+6E-9'. Invalid: '', '.', '1e', 'e3', '1.2.3', '+-1', '1e1.5'.

Examples

is_number(s: str) -> bool
Example 1
Inputis_number("-3.14")
OutputTrue