MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Python Built-in Types
Beginner
Q
What does this Python code print?
x = [3, 1, 2].sort()
print(x)
A[3, 1, 2]
BNone
CError
D[1, 2, 3]
Correct Answer:
B. None
Explanation:
list.sort() sorts in place and returns None. sorted() returns a new list.
ALSO KNOW (related points):
• Which of these values is truthy in Python? → "0"
• Which of these Python types is mutable? → bytearray
• What does None == False evaluate to in Python? → False