To determine the type of an object, we use type() function – which is a built-in function in python.
Python type() function
type() function is used to determine the type of an object, it accepts an object or value and returns it's type (i.e. a class of the object).
Syntax:
type(object)
Example:
Input:
b = 10.23
c = "Hello"
# Function call
print("type(b): ", type(b))
print("type(c): ", type(c))
Output:
type(b): <class 'float'>
type(c): <class 'str'>
Python code to determine the type of objects
Output
need an explanation for this answer? contact us directly to get an explanation for this answer