Python has a pretty fast algorithm built-in called an adaptive merge sort. Here is an example:
# sort a list of names without changing the original list
# uses the high speed sorting algorithm built-into Python
name_list1 = ['Frank', 'Mark', 'Hank', 'Zoe', 'Bob', 'Carl', 'Al']
name_list2 = sorted(name_list1)
print "Original:"
print name_list1
print "Sorted:"
print name_list2
"""my output -->
Original:
['Frank', 'Mark', 'Hank', 'Zoe', 'Bob', 'Carl', 'Al']
Sorted:
['Al', 'Bob', 'Carl', 'Frank', 'Hank', 'Mark', 'Zoe']
"""
If you have to create your own sorting algorithm, go with a selection sort. It is relatively slow, but rather easy to understand.
A selection sort of a list of numbers is pretty simple. You start
with two lists, let's call the original unsorted list the start_list
and you have another list call it the end_list which is empty at
the start.
If you want to sort ascending (lowest value first) you get the lowest
value of start_list using lowest = min(start_list) and append it to
the end_list with end_list.append(lowest). Now remove this value from
the start_list with start_list.remove(lowest) and repeat until the
start_list is empty and return the end_list with the sorted values. The repeat can be done with a while loop.