text. Decide whether it is a well-formed number. The rules are:
- **Digits**: one or more of the digits 0–9.
- **Sign**: an optional + or -.
- **Mantissa**: a sign followed by one of: digits (42); digits and a dot (42.); digits, a dot and digits (4.2); a dot and digits (.42).
- **Exponent**: the letter e or E, then a sign and digits (e7, E-3).
- **Number**: a mantissa, optionally followed by an exponent.
For example, "0", "007", "-3.", "+.25", "6e5" and "1.5E-2" are numbers, while "e9", "9e", "1-2", "++1", "1.2.3" and "x1" are not.
Return True if text is a number and False otherwise.text='-.5E+12' → True
A sign, a fraction with no integer part (.5) and the exponent E+12: everything follows the rules.
text='7e1.5' → False
The exponent after e must be an integer, and 1.5 is not.
text='+.' → False
A dot without a single digit is not a number.
text consists of English letters (upper and lower case), digits, +, - and .text='-.5E+12'
True
Run checks the first 3 tests in your browser. Submit checks all 308 tests on the server, hidden ones included.