from math import factorial



def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: int				,  __UpperCamelCase					: int				,  __UpperCamelCase					: float			)							->      float:







  """simple docstring"""





  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(__UpperCamelCase				,  __UpperCamelCase			) or not isinstance(__UpperCamelCase				,  __UpperCamelCase			):
    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"""			)
  SCREAMING_SNAKE_CASE__    							=   (prob**successes) * ((1 - prob) ** (trials - successes))
  # Calculate the binomial coefficient: n! / k!(n-k)!
  SCREAMING_SNAKE_CASE__    							=   float(factorial(__UpperCamelCase			)			)
  coefficient /= factorial(__UpperCamelCase			) * 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))

import enum
import shutil
import sys


__lowerCamelCase     ,		__lowerCamelCase    :				Optional[Any]							     =	shutil.get_terminal_size()

__lowerCamelCase    :				Any							     =	{'''UP''': '''A''', '''DOWN''': '''B''', '''RIGHT''': '''C''', '''LEFT''': '''D'''}







class __snake_case       (		enum.Enum	):
   lowerCAmelCase_														=							0
   lowerCAmelCase_														=							1





def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: Optional[int]				,  __UpperCamelCase					: List[str]=""			)							->      int:







  """simple docstring"""





  sys.stdout.write(str(__UpperCamelCase			) + end			)
  sys.stdout.flush()



def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: Optional[int]				,  __UpperCamelCase					: List[str]				,  __UpperCamelCase					: Optional[Any]=""			)							->      Dict:







  """simple docstring"""





  forceWrite(f"""\u001b[{color}m{content}\u001b[0m"""				,  __UpperCamelCase			)



def 			__SCREAMING_SNAKE_CASE						(      )							->      Optional[Any]:







  """simple docstring"""





  forceWrite("""\r"""			)



def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: int				,  __UpperCamelCase					: str			)							->      str:







  """simple docstring"""





  forceWrite(f"""\033[{num_lines}{CURSOR_TO_CHAR[direction.upper()]}"""			)



def 			__SCREAMING_SNAKE_CASE						(      )							->      Dict:







  """simple docstring"""





  forceWrite(""" """ * TERMINAL_WIDTH			)
  reset_cursor()






def 			__SCREAMING_SNAKE_CASE						(      )							->      int:







  """simple docstring"""





  reset_cursor()
  forceWrite("""-""" * TERMINAL_WIDTH			)
