Advertisement
jdeluxh

Sorting Function

Mar 23rd, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. def sorting(list1, counter=0):
  2.     while counter < len(list1)- 1:
  3.         if list1[counter] > list1[counter + 1]:
  4.             item = list1.pop(counter)
  5.             list1.insert(counter + 1, item)
  6.             counter = 0
  7.             return sorting(list1, counter)
  8.         else:
  9.             counter += 1
  10.             return sorting(list1, counter)
  11.     print(list1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement