def top_player_ids(info, statistics, formula, numplayers):
    """
    Inputs:
      info       - Baseball data information dictionary
      statistics - List of batting statistics dictionaries
      formula    - function that takes an info dictionary and a
                   batting statistics dictionary as input and
                   computes a compound statistic
      numplayers - Number of top players to return
    Outputs:
      Returns a list of tuples, player ID and compound statistic
      computed by formula, of the top numplayers players sorted in
      decreasing order of the computed statistic.
    """
    # create a list of tuples: playerIDs and computed formula statistic
    player_tup_list = []
    for line_dict in statistics:
        player_id = line_dict[info["playerid"]]
        player_stat = formula(info, line_dict)
        player_tup = (player_id, player_stat)
        player_tup_list.append(player_tup)
    # sort tuple list by computed statistic
    player_tup_list.sort(key=lambda pair: pair[1], reverse = True)
    # return only top numplayers requested
    return player_tup_list[:numplayers]