Is String a Number?

Is String a Number?

You are given a string. Your function should return True if the string is a valid number (contains digits only), otherwise - False. Look at the example.

example

Input: A string.

Output: A boolean.

Examples:

assert is_number("34") == True
assert is_number("df") == False
assert is_number("") == False
assert is_number("a5") == False

How it’s used: For checking string values that must contain only digits.

Precondition: The text contains only letters, digits and whitespace.