PYTHON CIRCLE
Practice
Python Books
Archive
Subscribe
Login
Menu
Login
Practice
Python Books
Archive
Subscribe
Python Multiple Choice Questions
If a={5,6,7}, what happens when a.add(5) is executed?
A. a={5,5,6,7}
B. a={5,6,7}
C. Error as there is no add function for set data type
D. Error as 5 already exists in the set
Show Answer
Next Question
Correct Answer:
B
Explanation: There exists add method for set data type. However 5 isn't added again as set consists of only non-duplicate elements and 5 already exists in the set. Execute in python shell to verify.
© 2022-2023 Python Circle
Contact
Sponsor
Archive
Sitemap