SHARE
TWEET

Sorting Function

jdeluxh Mar 23rd, 2013 101 Never
  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)
RAW Paste Data
Top