This is very basic but somehow I can’t seem to get it;
a = 12345 if a == type(int): print(True)
I also tried replacing int with float, but nothing prints- any idea why??
is a not an integer or float??
Advertisement
Answer
You want
if isinstance(a, int):
What you are doing is comparing an int
value to the type of the type int
; 12345 == type
is never going to be true.