I have an array called names with a list of 4 names.
e.g
Names[1]='John'
I want to get the program to sort my array so that FOR each item in the array, except the last one, IF the item is bigger than the next one, swap the two items.
Like this??
names = [ 'Zac' , 'John', 'Andrew' , 'James' ]
for name in sorted(names[:-1]) + [names[-1]]:
print name
Andrew
John
Zac
James
+ names[-1]print(name)
names.sort()?