





'''simple docstring'''






from decimal import Decimal, getcontext
from math import ceil, factorial







def 					_a						(       _lowerCamelCase ) ->				str:



			"""simple docstring"""


			if not isinstance(_lowerCamelCase    ,	_lowerCamelCase ):
						raise TypeError("""Undefined for non-integers""" )
			elif precision < 1:
						raise ValueError("""Undefined for non-natural numbers""" )

			__snake_case					:      Union[str, Any]							      =     precision
			__snake_case					:      List[Any]							      =     ceil(precision / 14 )
			__snake_case					:      List[str]							      =     42_6880 * Decimal(1_0005 ).sqrt()
			__snake_case					:      int							      =     1
			__snake_case					:      Tuple							      =     1359_1409
			__snake_case					:      Any							      =     Decimal(_lowerCamelCase )
			for k in range(1    ,	_lowerCamelCase ):
						__snake_case					:      str							      =     factorial(6 * k ) // (factorial(3 * k ) * factorial(_lowerCamelCase ) ** 3)
						linear_term += 5_4514_0134
						exponential_term *= -26_2537_4126_4076_8000
						partial_sum += Decimal(multinomial_term * linear_term ) / exponential_term
			return str(constant_term / partial_sum )[:-1]


if __name__ == "__main__":
	__UpperCamelCase					    =	50
	print(f"""The first {n} digits of pi is: {pi(n)}""")




from math import factorial


def      UpperCamelCase   (       __lowerCamelCase	:					int							,   __lowerCamelCase	:					int							,   __lowerCamelCase	:					float       ):
       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			:  Tuple     							= (prob**successes) * ((1 - prob) ** (trials - successes))
       # Calculate the binomial coefficient: n! / k!(n-k)!
       snake_case			:  str     							= 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))





