Can Someone Explain How To Do: If a == int: In Python?

–1 vote
asked Mar 14 by Vince Mendoza (210 points)

3 Answers

0 votes
answered Mar 16 by anonymous

there is a very very easy way:

a = 3

if int(a) == a:        #if a converted to int is same as floated int, I mean, if a is int

    #your code

+1 vote
answered Mar 16 by SID
a = ?

b = 1

if type(a) == type(b):

    print("that is it")
commented Mar 20 by Vince Mendoza (210 points)
Thank You!! This Will Help Me A lot On My Python projects !!!
0 votes
answered Mar 16 by anonymous

if type(a).__name__ == 'int':

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...