Tom_Jung

Untitled

Jan 28th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. from random import choice
  2. #players = ['Harry','Ginny','Neville', 'Hermione', 'Ghost'
  3. #players = ['Harry','Ginny','Neville', 'Hermione', 'Ghost', 'Cat']
  4. #players = ['Harry','Ginny','Neville', 'Hermione']
  5. players = ['Harry','Ginny']
  6. #players = ['Harry']
  7. #players = [ ]
  8.  
  9. #print(players)
  10.  
  11. teamA = [ ]
  12. teamB = [ ]
  13. teamC = [ ]
  14.  
  15. def team_selection():
  16.  
  17. while len(players) > 0:
  18. playerA = choice(players)
  19. teamA.append(playerA)
  20. players.remove(playerA)
  21.  
  22. if players == [ ]:
  23. break
  24. playerB = choice(players)
  25. teamB.append(playerB)
  26. players.remove(playerB)
  27.  
  28. if players == [ ]:
  29. break
  30.  
  31. playerC = choice(players)
  32. teamC.append(playerC)
  33. players.remove(playerC)
  34.  
  35. team_selection()
  36. print(teamA)
  37. print(teamB)
  38. print(teamC)
Advertisement
Add Comment
Please, Sign In to add comment