Guest User

Untitled

a guest
Dec 12th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. numbers = [999,888,777,666,555,444]
  2. change = True
  3. def print_list(list):
  4.     for i in list:
  5.         print i
  6.  
  7. def sort(list):
  8.     global change
  9.     change = False
  10.     print "Sorting..."
  11.     for i in range(0,(len(list)-1)):
  12.             if list[i] > list[i+1]:
  13.                 temp = list[i]
  14.                 list[i] = list[i+1]
  15.                 list[i+1] = temp
  16.                 change = True
  17.  
  18. print_list(numbers)
  19. while change:
  20.     sort(numbers)
  21. print_list(numbers)
Add Comment
Please, Sign In to add comment