0
Q:

if any number python

>>> def hasNumbers(inputString):
...     return any(char.isdigit() for char in inputString)
... 
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
9
if type(variable) == int or type(variable) == float:
    isNumber = True
2
def num_there(s):
    return any(i.isdigit() for i in s)
0
>>> def hasNumbers(inputString):
...     return any(char.isdigit() for char in inputString)
... 
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
0

New to Communities?

Join the community