xxxxxxxxxx
x = 10
print(type(x)) # Output: <class 'int'>
y = 3.14
print(type(y)) # Output: <class 'float'>
z = "Hello"
print(type(z)) # Output: <class 'str'>
xxxxxxxxxx
a = 123
b = 'Hello'
print('Is a an instance of str?', isinstance(a, str))
print('Is b an instance of str?', isinstance(b, str))
xxxxxxxxxx
X: type
{how do I check the type of a variable in Python?}
{type function}
{The type function returns the type of the given object. Example: var_type = type(42)}