fork download
  1. import random
  2.  
  3. def PickTeam(number_of_teams, player_names):
  4. PlayerList = player_names.split(", ")
  5. random.shuffle(PlayerList)
  6. teams = [PlayerList[i::number_of_teams] for i in range(number_of_teams)]
  7. return teams
  8.  
  9. for team in PickTeam(2, "Billy, Susie, Frank, Luke, Kensie, Jack"):
  10. print(team)
Success #stdin #stdout 0.02s 36944KB
stdin
Standard input is empty
stdout
['Frank', 'Billy', 'Susie']
['Jack', 'Kensie', 'Luke']