Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

0 votes
asked Mar 14, 2020 by Vince Mendoza (220 points)

3 Answers

0 votes
answered Mar 16, 2020 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, 2020 by SID
a = ?

b = 1

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

    print("that is it")
commented Mar 20, 2020 by Vince Mendoza (220 points)
Thank You!! This Will Help Me A lot On My Python projects !!!
0 votes
answered Mar 16, 2020 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.
...