"""Challenge 1-2"""


def calculate_depth_windows(depths: list[int]) -> list[int]:
    """Calculate sliding depth windows"""
    depth_windows: list[int] = []
    for index, depth in enumerate(depths):
        try:
            window = depth + depths[index + 1] + depths[index + 2]
            depth_windows.append(window)
        except IndexError:
            break

    return depth_windows


def calculate_depth_increases(depth_windows: list[int]) -> int:
    """Calculates the number of times the depth increases, compared to the previous depth band"""
    depth_increases: int = 0
    for index, window in enumerate(depth_windows):
        if index == 0:
            continue
        else:
            if window > depth_windows[index - 1]:
                depth_increases += 1
    return depth_increases
