What It Does
isinstance(object, classinfo) is a built-in function that checks if an object is an instance of a specific class or a subclass.
-
It returns:
True → if the object is an instance of the class
False → if it's not
In This Case
3.5 is a floating-point number
int refers to the integer data type
So, Python checks:
Is 3.5 an instance of int?
No, it’s an instance of float.
Output
Example Comparison
.png)

0 Comments:
Post a Comment