How to check if an object has the type int in Python

1 Answer

0 votes
n1 = 12
n2 = 3.14
n3 = 578.0

print(isinstance(n1, int))
print(isinstance(n2, int))
print(isinstance(n3, int))




'''
run:

True
False
False

'''

 



answered Aug 8, 2021 by avibootz

Related questions

1 answer 208 views
1 answer 167 views
1 answer 160 views
2 answers 246 views
1 answer 157 views
2 answers 180 views
...