Single Choice
Not Set
QWhat is the output of the following code
aSet = {1, 'PYnative', ['abc', 'xyz'], True}
print(aSet)
ID: #3807
Python Set MCQ
256 views
Question Info
#3807Q ID
Not SetDifficulty
Python Set MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
TypeError
If you try to execute the above code you will get a TypeError: unhashable type: 'list'
- It is true that the set itself is changeable (mutable), but it cannot contain changeable objects such as list and dictionary.
- Python set can contain unchangeable objects like number, string, tuple etc
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic