Write a program below that will demonstrate the different characteristics and method of the data type sets. 1. Type the following code on your Python script. 1 S1 = {1,2,3,3,3) (4,5,6} 2 s2 3 print (s1) 2. What is the output of line 3? 3. Add the 2 lines of code below. Discuss the output. 4 5 $3 (*s1, *s2} 6 print (53) 4. Add the final lines of code below. Try converting the additional list to a tuple by replacing the straight brackets with parenthesis. Explain the difference between the .add() method and .update() method. 7 8 s2.add(7) 9 print (s2) s2.update([10,11,12,13]) #take note: this is a list 10 11 print (52)

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 12E
icon
Related questions
Question

PYTHON PROGRAMMING

ANSWER ONLY #4

Write a program below that will demonstrate the different characteristics and methods
of the data type sets.
1. Type the following code on your Python script.
1 s1 = {1,2,3,3,3}
s2 = {4,5,6}
2
3
print(s1)
2. What is the output of line 3?
3. Add the 2 lines of code below. Discuss the output.
4
5
s3 = {*s1, *s2}
6
print (s3)
4. Add the final lines of code below. Try converting the additional list to a tuple by
replacing the straight brackets with parenthesis. Explain the difference between the
.add() method and .update() method.
7
s2.add(7)
9 print (s2)
10
s2.update([10,11,12,13]) #take note: this is a list
11 print (s2)
Transcribed Image Text:Write a program below that will demonstrate the different characteristics and methods of the data type sets. 1. Type the following code on your Python script. 1 s1 = {1,2,3,3,3} s2 = {4,5,6} 2 3 print(s1) 2. What is the output of line 3? 3. Add the 2 lines of code below. Discuss the output. 4 5 s3 = {*s1, *s2} 6 print (s3) 4. Add the final lines of code below. Try converting the additional list to a tuple by replacing the straight brackets with parenthesis. Explain the difference between the .add() method and .update() method. 7 s2.add(7) 9 print (s2) 10 s2.update([10,11,12,13]) #take note: this is a list 11 print (s2)
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
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,