def calculate_score(hazard_list, dictionary):
    """This function will take the hazard codes from a list and grab the respectvie hazard scores from a dictionary """

    score_list = []

    for code in hazard_list:

        # some of the codes end with a colon from extarcting from jsons. Remove them here if present.
        if code.endswith(':'):
            # removes last string from item, which will be the colon.
            code = code[:-1]

        for i in dictionary['Code']:  # loop through the dictionary
            if code == dictionary['Code'][i]:  # if code is present in dictionary
                # append the hazard score to the score list
                score_list.append(dictionary['Hazard Score'][i])

    return score_list