Chapter “Organising information: unordered structures”, exercise 2
Text
Consider the set created in the first exercise, stored in the variable my_set
. Describe the status of my_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"}))
.
Answer
The set will contain the elements "Frodo"
, "Sam"
, "Pippin"
, "Merry"
, "Galadriel"
, "Saruman"
, "Gandalf"
.