What is the usage of type in Python?

In Python, the function type() is a built-in function used to determine the type of an object.

The syntax of type() is:
type(object)

Among them, the object is the object whose type needs to be checked.

The return value of the type() function is a type object representing the type of the object.

For example, if x = 5, then print(type(x)) would output .

The variable y stores the value “hello,” and when we print the type of y, it shows that it is a string.

Output the type of the variable `z`, which is a list.

bannerAds