Source Code:
(back to article)
x = 5 print(isinstance(x, int)) # Output: True print(isinstance(x, str)) # Output: False y = 'hello' print(isinstance(y, str)) # Output: True print(isinstance(y, int)) # Output: False z = [1, 2, 3] print(isinstance(z, list)) # Output: True print(isinstance(z, tuple)) # Output: False
Result:
Report an issue