What is the output of the following code? set1 = {"John", "Mary", "Sam"} set1.add("David") print(set1) {'Mary', 'Sam', 'John', 'David'} {'Mary', 'Sam', 'John'} The program executes with error {'Mary', 'Sam', 'John', 'Eric'}

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question

9 python 

 

 

Question 9
What is the output of the following code?
set1 = {"John", "Mary", "Sam"}
set1.add("David")
print(set1)
{'Mary', 'Sam', 'John', 'David'}
{'Mary', 'Sam', 'John'}
The program executes with error
O {'Mary', 'Sam', 'John', 'Eric'}
Transcribed Image Text:Question 9 What is the output of the following code? set1 = {"John", "Mary", "Sam"} set1.add("David") print(set1) {'Mary', 'Sam', 'John', 'David'} {'Mary', 'Sam', 'John'} The program executes with error O {'Mary', 'Sam', 'John', 'Eric'}
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,