Validate a Decimal Number String

Implement isNumber(toTest: str) -> bool to determine whether a string represents a valid decimal number.

A valid number follows these rules:

  • It may optionally start with a minus sign -.
  • ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: