import csv


def lookup_player_names(info, top_ids_and_stats):
    """
    Inputs:
      info              - Baseball data information dictionary
      top_ids_and_stats - list of tuples containing player IDs and
                          computed statistics
    Outputs:
      List of strings of the form "x.xxx --- FirstName LastName",
      where "x.xxx" is a string conversion of the float stat in
      the input and "FirstName LastName" is the name of the player
      corresponding to the player ID in the input.
    """
    with open(info["masterfile"], newline='') as csvfile:
        reader = csv.DictReader(csvfile,
                                delimiter=info["separator"],
                                quotechar=info["quote"])
        
        player_names, player_info = {}, []

        for player in reader:
            player_names[player[info["playerid"]]] = (player[info["firstname"]], 
                                                      player[info["lastname"]])

        for top_id in top_ids_and_stats:
            player_info.append("{:0.3f} --- {} {}".format(top_id[1], 
                                                          player_names[top_id[0]][0],
                                                          player_names[top_id[0]][1]))
        return player_info