I'm trying to make a function that will take a string as an input, determine how many teams and the players in the list and sort the players randomly into teams. I'm using a discord bot for context, but it isn't important here.
I've tried to associate a number with the corresponding team's empty list, but dictionaries won't allow lists in them and I don't know how else two associate two values.
def PickTeam(string):
teamNum = number_of_teams
PlayerList = just_assume_this_is_a_good_list
team1 = []
team2 = []
team3 = []
team4 = []
teamDict = { 1:team1 , 2:team2 , 3:team3 }
while teamNum > 0:
for i in teamNum:
addPlayer = choice(PlayerList)
addTeam = teamDict[i]
addTeam.append(addPlayer)
for i in teamNum:
teamPub = teamDict[i]
print(teamPub)
I want to be able to input a number of teams and a list of names, like "2", and "Billy, Susie, Frank, Luke, Kensie, Jack" and have the output say something like "Billy, Luke, Susie", "Frank, Jack, Kensie", but there just isn't an output right now as the scripts stops at the dictionary holding lists. Any help would be appreciated, thanks!