my function is as below:
-------------------------------------
Expand|Select|Wrap|Line Numbers
- def sort(l):
- """sort a list of #s"""
- for i in range(len(l)-1):
- if l[i] > l[i+1]:
- l[i+1], l[i] = l[i], l[i+1]
- print l
i tried sort([32,25,31,3,6,4,0]), but the output only had sorted the some of the numbers. it gave [25, 31, 3, 6, 4, 0, 32] instead of giving me a list of ascending numbers.
where went wrong with my function?