Q29
What does the built-in function type() do in Python?
A.
Returns the type of an object
AnswerB.
Converts a string to lowercase
C.
Returns the square of a number
D.
Returns the absolute value of a number
Answer: Option A
Solution
Answer: Option A
Solution:
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:
x = 10
y = "Hello"
z = [1, 2, 3]
print(type(x)) # Output:
print(type(y)) # Output:
print(type(z)) # Output: