def get_avg_solo_league(league_dict, player_id_list): rank_num = 0 count = 0 for player_id in player_id_list: if str(player_id) in league_dict: player_dicts = league_dict[str(player_id)] for player_dict in player_dicts: if player_dict['queue'] == 'RANKED_SOLO_5x5': tier = player_dict['tier'] division = player_dict['entries'][0]['division'] rank_num += TIERS.index(tier)*5 rank_num += DIVS.index(division) count += 1 return num_to_rank(rank_num/count)
def rank_to_num(tier, div): rank_num = TIERS.index(tier)*5 + DIVS.index(div) return rank_num