def get_empty_player_season_record(player): """ Accepts a player name or names as a list Converts the names as follows ['Alan','Barry'] becomes Alan:Barry Returns a dictionary of 8 x [0,0,0,0] with the eight list representing the 8 starting positions and the list representing the frequency of Win, Place, Show, Lose """ team = ut.sorted_and_lowered(player) player = '' for p in team: player += p + ":" player = player.strip(":") player_season_record = {} num_times = [0,0,0,0] player_season_record[player] = [num_times[:],num_times[:],num_times[:],num_times[:],num_times[:],num_times[:],num_times[:],num_times[:]] return player_season_record
def update_player_season_record(player_season_record,player, start_pos, result): """ Accepts a dictionary for the player_eason_record, a list for the player and list of integers for the result """ # First check the dictionary matches the player list team = ut.sorted_and_lowered(player) player = '' for p in team: player += p + ":" player = player.strip(":") if player == player_season_record.keys()[0]: for v in player_season_record.values(): #print v v[start_pos-1][0] += result[0] v[start_pos-1][1] += result[1] v[start_pos-1][2] += result[2] v[start_pos-1][3] += result[3] return player_season_record