Tom_Jung

Untitled

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