from typing import List
from typing import Tuple


def _format_list(input_list: List, evals_per_gen: int) -> Tuple:
    """
    _format_list() takes as input data collected from multiple algorithm runs.
    Then, an average is computed and horizontal axis scaling is applied.
    The return value is a tuple of two list, each corresponds to a plot axis, ready to be plotted.
    """
    run_count = len(input_list)
    run_length = len(input_list[0])
    for i in input_list:
        assert len(i) == run_length, "Runs are of different length, cannot take average"
    y_axis = []
    for i in range(run_length):
        y_axis.append(sum([sigmas[i] for sigmas in input_list]) / run_count)
    x_axis = [x*evals_per_gen for x in range(run_length)]
    return x_axis, y_axis