Is String a Number? (Part II)

Is String a Number? (Part II)

You are given a string. Your function should return True if the string is a valid number (contains only digits and "+-." at proper places), otherwise - False. Look at the mask:

[+- ][zero or more digits][.][zero or more digits]

Of course, not all parts are necessary (but at least one digit part is!). For example, "+10." or "-.55" are valid numbers, where part equal 0 is omitted.

Input: A string (str).

Output: Logic value (bool).

Examples:

assert is_number("34") == True
assert is_number("df") == False
assert is_number("") == False
assert is_number("+10.0") == True