Sorting a list. : List Sort « List « Python






Sorting a list.

 

aList = [ 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 ]

print "Data items in original order"

for item in aList:
   print item,

aList.sort()

print "\n\nData items after sorting"

for item in aList:
   print item,

print

   
  








Related examples in the same category

1.Sort elements in a listSort elements in a list
2.List sort() DemoList sort() Demo