python type variable code example
Example 1: how to check the type of a variable in python
print(type(x))
Example 2: type de variable python
a=int(5)
b=float(5.6)
c=str("Hello world!")
Example 3: type in python
numbers_list = [1, 2]
print(type(numbers_list))
numbers_dict = {1: 'one', 2: 'two'}
print(type(numbers_dict))
class Foo:
a = 0
foo = Foo()
print(type(foo))
Output
<class 'dict'>
<class 'Foo'>
<class '__main__.Foo'>