"""
Recommended Python Style Guide:
https://peps.python.org/pep-0008/#introduction
"""


def hamming_distance(tab1, tab2, index):
    """
    Calculates the Hamming distance between two lists, 'tab1' and 'tab2', up to the specified index.
    The Hamming distance is the count of positions where the corresponding elements differ.

    Parameters:
    tab1 (list): First list to compare.
    tab2 (list): Second list to compare.
    index (int): Current index for recursive comparison; starts from the end of the list.

    Returns:
    int: The Hamming distance between the two lists.
    """
    # Base case: if the index is negative, return 0, as there are no elements to compare
    if index < 0:
        return 0
    else:
        # Recursive case: compare elements at the current index
        # If elements are equal, continue to the next index
        # If they differ, add 1 to the distance and continue
        return (1 if tab1[index] != tab2[index] else 0) + hamming_distance(tab1, tab2, index - 1)


# Sample lists to compare
tab1 = [10, 123, 141, -123, 3423, 2, 1, 4, 5, 6, 7, 3, 4, 5, 8, 7, 5, 4, 12, 32]
tab2 = [1, 12, 141, -123, 132, 2, 1, 4, 5, 6, 7, 3, 34, 5, 8, 7, 5, 4, 2, 32]

# Calculate and print the Hamming distance between tab1 and tab2
print("Hamming distance =", hamming_distance(tab1, tab2, len(tab1) - 1))
