Advertisement
sabchap

Untitled

Apr 27th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. def sortLeague():
  2. allteams = createLeauge()#calls previous function
  3. loop = True#condition for while loop
  4. while loop == True :
  5. loop = False
  6. i = 0
  7. for i in range (len(allteams)-1):#bubble sort based on points, or wins if that is equal
  8.  
  9. if allteams[i][5] < allteams[i+1][5]:
  10. temp = allteams[i]
  11. allteams[i] = allteams[i+1]
  12. allteams[i+1] = temp
  13. loop = True
  14. elif allteams[i][5] == allteams[i+1][5]:
  15. if allteams[i][2]< allteams[i+1][2]:
  16. temp = allteams[i]
  17. allteams[i] = allteams[i+1]
  18. allteams[i+1] = temp
  19. loop = True
  20.  
  21. return allteams#should return leauge sorted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement