biology = ["Sarah", "Ahmed", "Fred", "Gillian", "Shradah", "Max", "Max", "Sara", "Max", "Esther"]
computerScience = ["Sarah", "John", "Fred", "Gillian", "Jermaine", "Max", "Sara", "Juan", "Esther"]
english = ["Nico", "Sharjeel", "Isabella", "Taylor", "Ali", "Ali", "Jean-Baptiste", "Jean-Baptiste", "Jean-Baptiste", "William"]
setThing=set()
for word in biology:
setThing.add(word)
listThing=[]
for word in setThing:
listThing.append(word)
print(listThing)
在此,我试图将名为生物学的列表放入一个集合中,以便消除重复。我试图将其转回一个与列表具有相同名称顺序的列表:生物学。但当我把它变成一套时,名字的顺序就完全改变了。有什么方法可以使用某种函数来订购新集或新列表,以便名称与原始“生物学”列表的顺序相同?
杨魅力
相关分类