





def       A__(		__lowerCAmelCase	,			__lowerCAmelCase ):

    # Check if the input is valid
    if not len(__lowerCAmelCase ) == len(__lowerCAmelCase ) == 3:
        raise ValueError('Please enter a valid equation.' )
    if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0:
        raise ValueError('Both a & b of two equations can\'t be zero.' )

    # Extract the coefficients
    _snake_case :			Optional[Any]  						=   equationa
    _snake_case :			List[str]  						=   equationa

    # Calculate the determinants of the matrices
    _snake_case :			Optional[int]  						=   aa * ba - aa * ba
    _snake_case :			Any  						=   ca * ba - ca * ba
    _snake_case :			Dict  						=   aa * ca - aa * ca

    # Check if the system of linear equations has a solution (using Cramer's rule)
    if determinant == 0:
        if determinant_x == determinant_y == 0:
            raise ValueError('Infinite solutions. (Consistent system)' )
        else:
            raise ValueError('No solution. (Inconsistent system)' )
    else:
        if determinant_x == determinant_y == 0:
            # Trivial solution (Inconsistent system)
            return (0.0, 0.0)
        else:
            _snake_case :			str  						=   determinant_x / determinant
            _snake_case :			Optional[Any]  						=   determinant_y / determinant
            # Non-Trivial Solution (Consistent system)
            return (x, y)













from math import factorial

def       A__(		__lowerCAmelCase	,			__lowerCAmelCase	,			__lowerCAmelCase ):
				if successes > trials:
								raise ValueError('successes must be lower or equal to trials' )
				if trials < 0 or successes < 0:
								raise ValueError('the function is defined for non-negative integers' )
				if not isinstance(__lowerCAmelCase	,			__lowerCAmelCase ) or not isinstance(__lowerCAmelCase	,			__lowerCAmelCase ):
								raise ValueError('the function is defined for non-negative integers' )
				if not 0 < prob < 1:
								raise ValueError('prob has to be in range of 1 - 0' )
				_snake_case :			Optional[int]  						=   (prob**successes) * ((1 - prob) ** (trials - successes))
				# Calculate the binomial coefficient: n! / k!(n-k)!
				_snake_case :			List[Any]  						=   float(factorial(__lowerCAmelCase ) )
				coefficient /= factorial(__lowerCAmelCase ) * factorial(trials - successes )
				return probability * coefficient


if __name__ == "__main__":
		from doctest import testmod

		testmod()
		print('''Probability of 2 successes out of 4 trails''')
		print('''with probability of 0.75 is:''', end=''' ''')
		print(binomial_distribution(2, 4, 0.75))






