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