Advertisement
lubattillah

pick2teams

Jun 11th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. players=["Harry", "Hermione", "Neville", "Ginny"]
  2.  
  3. def add_player_to_team(team):
  4. player_picked=choice(players)
  5. team.append(player_picked)
  6. players.remove(player_picked)
  7.  
  8. # Add a player to each team
  9.  
  10. loop=(len(players)/2)
  11. while loop!=0:
  12. add_player_to_team(teamA)
  13. add_player_to_team(teamB)
  14. loop=loop-1
  15.  
  16. print(teamA)
  17. print(teamB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement