from typing import List
from typing import Dict


def calculate_gpa(grades: List[str], weights: Dict[str, float]) -> float:
    """
    Takes a list of letter grades, and a dictionary that provides
    the relative weights of those letter grades in GPA format. It
    calculates a GPA based on the number of grades and their weights
    rounded to two decimal places.

    Args:
        grades (List[str]): A list of letter grades, e.g. A, B+, C, A-, etc.
        weights (Dict[str, float]): The dictionary equating letter grades to their weight

    Returns:
        float: The calculated GPA
    """

    credit = 0.0

    for grade in grades :
        credit += weights[grade]

    final_grades = credit / len(grades)

    return round(final_grades, 2)