test Pythona, jeśli ciąg jest int int
'16'.isdigit()
>>>True
'3.14'.isdigit()
>>>False
'Some text'.isdigit()
>>>False
Yvant2000
'16'.isdigit()
>>>True
'3.14'.isdigit()
>>>False
'Some text'.isdigit()
>>>False
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)
str = input("Enter any value: ")
if str.isdigit():
print("User input is an Integer ")
else:
print("User input is string ")
s = set(str(4059304593))
print('2' in s)