?
What does the built-in function type() do in Python?
Answer & Solution
Correct Answer:
Option
A
The correct answer is Option A: Returns the type of an object.
The type() function in Python is used to get the type of an object. It returns the type of the object passed as an argument. This can be useful for checking the type of variables or objects during runtime.
For example:
The type() function in Python is used to get the type of an object. It returns the type of the object passed as an argument. This can be useful for checking the type of variables or objects during runtime.
For example:
x = 10
y = "Hello"
z = [1, 2, 3]
print(type(x)) # Output:
print(type(y)) # Output:
print(type(z)) # Output:
Join the Discussion
Login to post a comment or share your explanation.
Login