Advertisement
Guest User

Untitled

a guest
Jan 31st, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. def more(item1, item2):
  2. # item1 > item2
  3. if item1[0] > item2[0]:
  4. return True
  5. elif item1[0] == item2[0]:
  6. if item1[1] > item2[1]:
  7. return True
  8. return False
  9.  
  10. def sorter(massive):
  11. for i in range(len(massive)):
  12. for j in (range(len(massive)- i -1)):
  13. if more(massive[j], massive[j+1]):
  14. massive[j], massive[j + 1] = massive[j + 1], mas[j]
  15.  
  16. mas = [[3,1],[1,2],[1,3],[2,2],[2,1],[3,2],[2,2],[1,-1]]
  17. sorter(mas)
  18. print(mas)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement