txt = "565543"
x = txt.isnumeric()
if type(variable) == int or type(variable) == float:
isNumber = True
def num_there(s):
return any(i.isdigit() for i in s)
var.isdigit()
#return true if all the chars in the string are numbers
#return false if not all the chars in the string are numbers
colors = [11, 34.1, 98.2, 43, 45.1, 54, 54]
for x in colors:
if int(x) == x:
print(x)
#or
if isinstance(x, int):
print(x)
N.is_integer()
import numbers
variable = 5
print(isinstance(5, numbers.Number))
myVariable = input('Enter a number')
if type(myVariable) == int or type(myVariable) == float:
# Do something
else:
print('The variable is not a number')
>>> def hasNumbers(inputString):
... return any(char.isdigit() for char in inputString)
...
>>> hasNumbers("I own 1 dog")
True
>>> hasNumbers("I own no dog")
False
s = set(str(4059304593))
print('2' in s)