Chapter “Organising information: ordered structures”, exercise 1
Text
Write a sequence of instructions in Python to create a list with the following elements ordered alphabetically: "Harry"
, "Draco"
, "Hermione"
, "Ron"
, "Severus"
.
Answer
my_list = list()
my_list.append("Draco")
my_list.append("Harry")
my_list.append("Hermione")
my_list.append("Ron")
my_list.append("Severus")
Additional material
The runnable Python file is available online.