Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import *
- teamA=[]
- teamB=[] #create 2 empty lists for team A and B
- players = ["Tom","Dick","Harry","Nigel","Sid","Bill","Sam","Will","D","P","X","Z","Y"]
- print(players)
- shuffle(players)
- print(players)
- def add_player_to_team(team):
- #shuffle(players)
- #remove a player from the list and add them to the team
- player_picked = players.pop(-1)
- team.append(player_picked)
- #players.remove(player_picked)
- #team = choice(teams)
- i = int(len(players)/2)
- for player in range(i):
- add_player_to_team(teamA)
- add_player_to_team(teamB)
- if len(players) == 1:
- add_player_to_team(teamA)
- else:
- print("teamA = "+str(teamA), "teamB = " +str(teamB))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement