Chapter “Organising information: unordered structures”, exercise 1
Text
Write a code in Python to create a set of the following elements: "Bilbo"
, "Frodo"
, "Sam"
, "Pippin"
, "Merry"
.
Answer
my_set = set()
my_set.add("Bilbo")
my_set.add("Frodo")
my_set.add("Sam")
my_set.add("Pippin")
my_set.add("Merry")
Additional material
The runnable Python file is available online.