


from math import factorial




def        snake_case_					(  snake_case      ,							snake_case      ,							snake_case					)  ->    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(snake_case      ,							snake_case					) or not isinstance(snake_case      ,							snake_case					):
              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'					)
       lowercase__:       Optional[Any]        =       (prob**successes) * ((1 - prob) ** (trials - successes))
       # Calculate the binomial coefficient: n! / k!(n-k)!
       lowercase__:       int        =       float(factorial(snake_case					)					)
       coefficient /= factorial(snake_case					) * 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))






from __future__ import annotations




def        snake_case_					(  snake_case      ,							snake_case					)  ->    list[str]:
       if nth_term == "":
              return [""]
       lowercase__:       Tuple        =       int(snake_case					)
       lowercase__:       int        =       int(snake_case					)
       lowercase__:       list[str]        =       []
       for temp in range(int(snake_case					)					):
              series.append(f'1 / {pow(temp + 1      ,							int(snake_case					)					)}' if series else '1'					)
       return series


if __name__ == "__main__":
 import doctest

 doctest.testmod()

 __lowerCAmelCase			=							int(input('''Enter the last number (nth term) of the P-Series'''))
 __lowerCAmelCase			=							int(input('''Enter the power for  P-Series'''))
 print('''Formula of P-Series => 1+1/2^p+1/3^p ..... 1/n^p''')
 print(p_series(nth_term, power))


