>>> def hasNumbers(inputString):
... return any(char.isdigit() for char in inputString)
...
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
print("012345".isdecimal())
OUTPUT
True
print("a12345".isdecimal())
OUTPUT
False
>>> 'A'.isdigit()
False
>>> '1'.isdigit()
True
s = "abc1"
contains_digit = any(map(str.isdigit, s))
print(contains_digit)
def containsNumber(value):
for character in value:
if character.isdigit():
return False
return True
for number in numbers:
if '4' in str(number):
print('{} True'.format(number))
else:
print("False")