So I have a deque of people objects. A person contains a name and an age, that's it. I'm trying to figure out how to sort the deque on the name field.
Any idea how to sort, just based on the name field?
p1 = person("Tom", 31) p2 = person("Jason", 33) p3 = person("Adam", 23) p4 = person("Megan", 28) classroom = deque() classroom.append(p1) classroom.append(p2) classroom.append(p3) classroom.append(p4) #deque is now full of unsorted people
Any idea how to sort, just based on the name field?