search

What is the use of the "type" function in Python?

The **type** function in Python is used to determine the type of an object, and it returns the type of the object passed as an argument.

For example:

>>> x = 10
>>> type(x)
<class 'int'>
>>> y = "Hello"
>>> type(y)
<class 'str'>

In the above example, the **type** function is used to find the type of **x** and **y** variables, and it returns the type of the object.

Related Questions You Might Be Interested