Answers for "check for the negative integers and float"

0

check for the negative integers and float

def is_number(n):
    try:
        float(n)   # Type-casting the string to `float`.
                   # If string is not a valid `float`, 
                   # it'll raise `ValueError` exception
    except ValueError:
        return False
    return True
Posted by: Guest on January-10-2022

Code answers related to "check for the negative integers and float"

Python Answers by Framework

Browse Popular Code Answers by Language