-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lecture "Organising information: unordered structures", exercise 2 #23
Comments
my_set = {'Frodo', 'Sam', 'Pippin', 'Merry', 'Galadriel', 'Saruman', 'Gandalf'} |
my_set.remove("Bilbo") my_set.add("Galadriel") my_set.update(set({"Saruman", "Frodo", "Gandalf"})) |
|
my_set = { "Frodo", "Sam", "Saruman", "Pippin", "Merry", "Galadriel", "Gandalf"} |
|
|
|
my_set = {"Frodo", "Sam", "Pippin", "Merry", "Galadriel", "Saruman", "Gandalf"} |
‘’’ Set={'Frodo', 'Merry', 'Pippin', 'Sam'} my_set.add("Galadriel") my_set.update(set({"Saruman", "Frodo", "Gandalf"})). Set={'Frodo', 'Merry', ‘Galadriel’, 'Pippin', 'Sam', 'Saruman', 'Gandalf' } #frodo just one time because a set has no-repeatable elements ‘’’ |
The set is composed by the followings strings: "Frodo", "Merry", "Pippin", "Sam", "Bilbo".
|
|
|
my_set={'Frodo', 'Saruman', 'Pippin', 'Galadriel', 'Gandalf', 'Sam', 'Merry'} |
Input
Output
|
|
|
|
Consider the set created in the first exercise, stored in the variable
my_set
. Describe the status ofmy_set
after the execution of each of the following operations: my_set.remove("Bilbo")
, my_set.add("Galadriel")
, my_set.update(set({"Saruman", "Frodo", "Gandalf"}))
.The text was updated successfully, but these errors were encountered: