comp-think / 2020-2021

The GitHub repository containing all the material related to the Computational Thinking and Programming course of the Digital Humanities and Digital Knowledge degree at the University of Bologna (a.a. 2020/2021).
14 stars 9 forks source link

Lecture "Organising information: ordered structures", exercise 1 #13

Open essepuntato opened 3 years ago

essepuntato commented 3 years ago

Write a sequence of instructions in Python to create a list with the following elements ordered alphabetically: "​Harry"​, "​Draco"​, "​Hermione"​, ​"​Ron"​, "​Severus"​.

SarahTew commented 3 years ago

hp_list = list() hp_list.append("Draco") hp_list.append("Harry") hp_list.append("Hermione") hp_list.append("Ron") hp_list.append("Severus") print (hp_list)

Fran-cesca commented 3 years ago
FIRST METHOD
hp_list= list()
hp_list.append("Draco")
hp_list.append("Harry")
hp_list.append("Hermione")
hp_list.append("Ron")
hp_list.append("Severus")
print (hp_list)

SECOND METHOD
hp1_list= ["Draco", "Harry", "Hermione", "Ron", "Severus"]
print (hp1_list)

THIRD METHOD
hp2_list= list()
hp2_list.append("Harry")
hp2_list.append("Severus")
hp2_list.append("Hermione")
hp2_list.append("Ron")
hp2_list.append("Draco")
hp2_list.sort()
print(hp2_list)
ChiaraCati commented 3 years ago

my_list_hp=list() my_list_hp.append("Draco") my_list_hp.append("Harry") my_list_hp.append("Hermione") my_list_hp.append("Ron") my_list_hp.append("Severus")

print(my_list_hp)

margheparla commented 3 years ago

my_list= list() my_list.append("Harry") my_list.append("Draco") my_list.append("Hermione") my_list.append("Severus") my_list.append("Ron") my_list.sort() print(my_list)

yunglong28 commented 3 years ago

lista_hp = list['Draco', 'Harry', 'Hermione', 'Ron', 'Severus'] print(lista_hp)

penelopelask commented 3 years ago

#FIRST METHOD
Harry_potter_list = list()
Harry_potter_list.append("Draco")
Harry_potter_list.append("Harry")
Harry_potter_list.append("Hermione")
Harry_potter_list.append("Ron")
Harry_potter_list.append("Severus")
print(Harry_potter_list)

#SECOND METHOD
Harry_potter_list = list()
Harry_potter_list.append("Hermione")
Harry_potter_list.append("Draco")
Harry_potter_list.append("Severus")
Harry_potter_list.append("Ron")
Harry_potter_list.append("Harry")
Harry_potter_list.sort()
print(Harry_potter_list)

#THIRD METHOD
Harry_potter_list = ["Draco", "Harry", "Hermione", "Ron", "Severus"]
print(Harry_potter_list)```
AleRosae commented 3 years ago
my_list = list()
my_list.append("Draco")
my_list.append("Harry")
my_list.append("Hermione")
my_list.append("Ron")
my_list.append("Severus")

print(my_list)
edoardodalborgo commented 3 years ago
#with user input
names_list = input('Enter each name separed by a comma: ').split(', ')
print(sorted(names_list))

#without user input
names_list = list()
names_list.append("Severus")
names_list.append("Harry")
names_list.append("Ron")
names_list.append("Hermione")
names_list.append("Draco")
print(sorted(names_list))
laurentfintoni commented 3 years ago

my_list = list() my_list.append("Draco") my_list.append("Harry") my_list.append("Hermione") my_list.append("Ron") my_list.append("Severus")

print(my_list)

dbrembilla commented 3 years ago
harry_potter_names = list()
harry_potter_names.append("Draco")
harry_potter_names.append("Harry")
harry_potter_names.append("Hermione")
harry_potter_names.append("Ron")
harry_potter_names.append("Severus")
vanessabonanno commented 3 years ago

my_hp_list = list() my_hp_list.append("Draco") my_hp_list.append("Harry") my_hp_list.append("Hermione") my_hp_list.append("Ron") my_hp_list.append("Severus")

print(my_hp_list)

AlessandraFa commented 3 years ago
hp_list = list()
hp_list.append("Draco")
hp_list.append("Harry")
hp_list.append("Hermione")
hp_list.append("Ron")
hp_list.append("Severus")
print(hp_list)
LuisAmmi commented 3 years ago
hogwarts_list = list()
hogwarts_list.append("Draco")
hogwarts_list.append("Harry")
hogwarts_list.append("Hermione")
hogwarts_list.append("Ron")
hogwarts_list.append("Severus")

print(hogwarts_list)
gabrielefiorenza commented 3 years ago
my_list = list()
my_list.append("Draco")
my_list.append("Harry")
my_list.append("Hermione")
my_list.append("Ron")
my_list.append("Severus")

print(my_list)
giorgiasampo commented 3 years ago

harry_list = list() harry_list.append("Harry") harry_list.append("Severus") harry_list.append("Hermione") harry_list.append("Ron") harry_list.append("Draco") harry_list.sort() print(harry_list)

samuelespotti commented 3 years ago

potter_list= list() potter_list.append("Draco") potter_list.append("Harry") potter_list.append("Hermione") potter_list.append("Ron") potter_list.append("Severus") print (potter_list)

fcagnola commented 3 years ago
mylist = []
mylist.append("harry")
mylist.append("draco")
mylist.append("hermione")
mylist.append("ron")
mylist.append("severus")
print(mylist)
GiuliaMenna commented 3 years ago
harry_potter_list = list()
harry_potter_list.append("Draco")
harry_potter_list.append("Harry")
harry_potter_list.append("Hermione")
harry_potter_list.append("Ron")
harry_potter_list.append("Severus")

print(harry_potter_list)
SusannaPinotti commented 3 years ago
HP_list = list()
HP_list.append("Harry")
HP_list.append("Draco")
HP_list.append("Hermione")
HP_list.append("Ron")
HP_list.append("Severus")
HP_list.sort()

print(HP_list)
enri-ca commented 3 years ago
HPE=list()
HPE.append("Draco")
HPE.append("Harry")
HPE.append("Hermione")
HPE.append("Ron")
HPE.append("Severus")
print(HPE)
alicebordignon commented 3 years ago

potter_list = [] potter_list.append("Harry") potter_list.append("Draco") potter_list.append("Hermione") potter_list.append("Ron") potter_list.append("Severus") potter_list.sort() print(potter_list)

DeniseBas commented 3 years ago

hp_list = list()

hp_list.append('Harry') hp_list.append("Draco") hp_list.append("Hermione") hp_list.append("Ron") hp_list.append("Severus") hp_list.sort()

print(hp_list)

IlaRoss commented 3 years ago
hp_characters = ["Hermione", "Ron", "Draco", "Harry"]
hp_characters.append("Severus")
hp_characters.sort()