Numeric Check in Python

Level 124 keystrokes

This checks if all characters in a string are numeric using the isnumeric() method.

Python code

# isnumeric() returns True if the string is not empty and every character is numeric
# Unlike isdigit(), it also accepts characters such as "½"; "123" passes, so True is printed
1print("123".isnumeric())

Output

True
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • "× 2
  • (× 2
  • )× 2
  • .× 1

More Python examples at level 1

← Python typing practice