Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from random import choice
  2.  
  3. teamA = []
  4. teamB = [] # Create two empty lists for teams A and B
  5.  
  6. players = ['Harry', 'Hermione', 'Neville', 'Ginny']
  7. pool= int(len(players)/2)
  8. print (pool)
  9.  
  10. def add_player_to_team(team):
  11. for i in range(0,pool):
  12. player_picked = choice(players)
  13. team.append(player_picked)
  14. players.remove(player_picked)
  15.  
  16. # Add a player to each team
  17. add_player_to_team(teamA)
  18. add_player_to_team(teamB)
  19. print (teamA)
  20. print (teamB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement