Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. from random import shuffle
  2. #shuffle function randomises the order of the whole list
  3.  
  4. players = ['A','B','C','D','F','E','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
  5.  
  6. teamA2 = []
  7. teamB2 = []
  8. shuffle(players)
  9.  
  10. if len(players) < 4 :
  11. print("Error, the minimum required for the game is upper or equal to 4.")
  12. elif len(players) == 0 :
  13. print("Error, the minimum required for the game is upper or equal to 4.")
  14. else :
  15. while players != [] :
  16. teamA2.append(players[-1])
  17. players.pop(-1)
  18. teamB2.append(players[-1])
  19. players.pop(-1)
  20. print(teamA2)
  21. print(teamB2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement