Code: Select all
players = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R']
# define the add_player to team function
def add_player_to_team(team1, team2):
# pick a player and add them to the team list and remove from available players
#shuffle(players)
if len(players) < 2:
return "Not enough players."
else:
for z in players:
# Pick Team 1
player_picked = choice(players)
team1.append(player_picked)
players.remove(player_picked)
# Pick Team 2
player_picked = choice(players)
team2.append(player_picked)
players.remove(player_picked)
return team1, team2