MCQ Single Best Answer Not Set

QWhat is the output of the following code
aSet = {1, 'PYnative', ('abc', 'xyz'), True}
print(aSet)

ID: #3798 Python Set MCQ 374 views
Question Info
#3798Q ID
Not SetDifficulty
Python Set MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A {
  • B {
  • C TypeError
  • D None
Correct Answer: Option B

Explanation

{‘PYnative’, 1, (‘abc’, ‘xyz’)}

Set already has 1 as item True evaluates to 1. As you know set doesn’t allow duplicate element

Share This Question

Challenge a friend or share with your study group.