"""
Recommended Python Style Guide:
https://peps.python.org/pep-0008/#introduction
"""


def pascals_triangle(row, col):
    """
    Recursively calculates the Pascal's Triangle coefficient at the specified row and column.

    Parameters:
    row (int): The row index of the Pascal's Triangle (starting from 0).
    col (int): The column index within the row (starting from 0).

    Returns:
    int: The value of the Pascal's Triangle coefficient at (row, col).
    """
    # Base case: The first and last elements of each row are 1
    if col == 0 or col == row:
        return 1
    else:
        # Recursive case: Sum of the two coefficients from the previous row
        return pascals_triangle(row - 1, col) + pascals_triangle(row - 1, col - 1)


# Prompt user for input
print("Enter the row and column of the Pascal's Triangle:")
row = int(input("row: "))
col = int(input("col: "))

# Ensure the row and col values are valid: col must be between 0 and row (inclusive), and both must be non-negative
while col < 0 or col > row or row < 0:
    print("Invalid input. Please ensure col is between 0 and row, and both are non-negative.")
    row = int(input("row: "))
    col = int(input("col: "))

# Output the Pascal coefficient at the given (row, col)
print(f"Pascal's element at row {row}, col {col} = {pascals_triangle(row, col)}")
