Skip to main content

type()

The type() function in Python is a built-in function used to get the type of an object. It returns the type of the object as a value of type type, which can be used to determine the type of the object passed as an argument to the function.

Parameter Values

Parameter Description
obj

The object whose type is to be returned.

Return Values

The type() function returns a type object or a new type if arguments are provided.

How to Use type() in Python

Example 1:

The type() function returns the type of an object. It is useful for checking the type of variables or objects in Python.

type(5) # Output: 
type('hello') # Output: 
type([1, 2, 3]) # Output: