






def 				snake_case__							(							UpperCAmelCase							:  List[Any]    ,			UpperCAmelCase							:  str    ,			UpperCAmelCase							:  Union[str, Any]       ):







    if principal <= 0:
        raise Exception("Principal borrowed must be > 0"       )
    if rate_per_annum < 0:
        raise Exception("Rate of interest must be >= 0"       )
    if years_to_repay <= 0 or not isinstance(lowercase__    ,			lowercase__       ):
        raise Exception("Years to repay must be an integer > 0"       )

    # Yearly rate is divided by 12 to get monthly rate
    lowerCAmelCase__   :Optional[int]      							=				rate_per_annum / 1_2

    # Years to repay is multiplied by 12 to get number of payments as payment is monthly
    lowerCAmelCase__   :Dict      							=				years_to_repay * 1_2

    return (
        principal
        * rate_per_month
        * (1 + rate_per_month) ** number_of_payments
        / ((1 + rate_per_month) ** number_of_payments - 1)
    )


if __name__ == "__main__":
 import doctest

 doctest.testmod()











from __future__ import annotations

import numpy as np


def 				snake_case__							(							UpperCAmelCase							:  np.ndarray       ):
    lowerCAmelCase__							,lowerCAmelCase__   :List[str]      							=				np.shape(UpperCAmelCase       )
    if rows != columns:
        lowerCAmelCase__   :Tuple      							=				(
            "'table' has to be of square shaped array but got a "
            F'''{rows}x{columns} array:\n{table}'''
        )
        raise ValueError(UpperCAmelCase       )

    lowerCAmelCase__   :Optional[Any]      							=				np.zeros((rows, columns)       )
    lowerCAmelCase__   :Tuple      							=				np.zeros((rows, columns)       )
    for i in range(UpperCAmelCase       ):
        for j in range(UpperCAmelCase       ):
            lowerCAmelCase__   :Any      							=				sum(lower[i][k] * upper[k][j] for k in range(UpperCAmelCase       )       )
            if upper[j][j] == 0:
                raise ArithmeticError("No LU decomposition exists"       )
            lowerCAmelCase__   :Any      							=				(table[i][j] - total) / upper[j][j]
        lowerCAmelCase__   :Tuple      							=				1
        for j in range(UpperCAmelCase    ,			UpperCAmelCase       ):
            lowerCAmelCase__   :Optional[Any]      							=				sum(lower[i][k] * upper[k][j] for k in range(UpperCAmelCase       )       )
            lowerCAmelCase__   :Dict      							=				table[i][j] - total
    return lower, upper


if __name__ == "__main__":
 import doctest

 doctest.testmod()



