Test Index

Python Revision Tour Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 28 of 102
Marks: +1, -0
State True or False :
“A Python List must always contain all its elements of same data type.”
[CBSE 2025 Set 4]
Solution:  
Concept:
A Python list is a heterogeneous sequence: each element can be of any data type, and different elements may have different types.
Explanation:
The following list is perfectly valid:
>>> L = [10, 'Ravi', 85.5, True, [1, 2]]
>>> [type(x).__name__ for x in L]
['int', 'str', 'float', 'bool', 'list']
So a list does not need all its elements to be of the same type. The statement is False.
Key point: Python lists (and tuples) can mix data types; a string, by contrast, can hold only characters.
Answer:
Option B (False)
© examsnet.com
Advertisements
Go to Question: