
Problem –
You want to determine the type of an object in python.
Solution –
To know the type of an object in python, you can use the built-in type() function.
In [1]: num = 5
In [2]: type(num)
Out[2]: int
In [3]: name = 'John'
In [4]: type(name)
Out[4]: str
In [5]: lst = [5, 10, 15, 20]
In [6]: type(lst)
Out[6]: list
In [7]: person = {'Name':'Noah', 'Age': 25, 'Location': 'New York'}
In [8]: type(person)
Out[8]: dict