def calc_moving_average(data, n):
    """Calculates the average of the last n values in the data dictionary

    :param data: dictionary
    :param n: number of days used to calculate the moving average
    :return: integer value of the average
    """
    past_n_days = data[-n:]
    sum_values = 0
    for day in past_n_days:
        sum_values += day["daily_deaths"]
    n_moving_average = int(sum_values / n)
    return n_moving_average