Basically you can sort after you put your data in your list: L = [1.2,1.23,4.5,2] L.sort() print L
L = ["a","c","b","A","C","B"] L.sort() print L Result: [1.2, 1.23, 2, 4.5] ['A', 'B', 'C', 'a', 'b', 'c'] #------------------------------------------------------------ remember in character the "A" has lower ascii value then "a" To model this as a function you just need this code for two of them: def funcSort(myList): result = myList[:] result.sort() return result Use of this function: L = [1.2,1.23,4.5,2] res1 = funcSort(L) print res1 L = ["a","c","b","A","C","B"] res1 = funcSort(L) print res1 Best Regards, Pujo -- http://mail.python.org/mailman/listinfo/python-list