type()Easy Examples

Returns the type of an object, or creates a new type dynamically

Basic type() usage

Simple demonstration of the type() built-in function.

python
print(type(42))
print(type("hello"))
print(type([1, 2, 3]))
print(type(True))

type() is a built-in function that returns the type of an object, or creates a new type dynamically.

type() with different inputs

Calling type() with various argument types.

python
# More type() examples
print("type() is a Python built-in function")
print(f"Type: {type(type)}")

type() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground