
    ʾg&                         d Z dZdZdZdZddlT ddeded	efd
Zdeded	efdZde	d	e	fdZ
edk    r ee
d           dS dS )z.BINO : compute the binomial coefficient C(n,p)z-Christophe Schlick modified by Philippe Blasiz1.0z
2022-11-12z]
User input : <n>,<p> (where n:int >= 0, p:int >= 0)
App output : binomial coefficient C(n,p)    )*nmreturnc                 F    d}t          |dz   | dz             D ]}||z  }|S )z$return n! (iterative implementation)   )range)r   r   resultis       O/autofs/unityaccount/pages_web_perso/pblasi100p/pai/python/SOL-A/G1/A3B_bino.pyfactor      s8     &1QqS>>  a
aKFF	-    pc                     || |z
  k    r#t          | |          t          | |z
            z  S t          | | |z
            t          |          z  S )z@compute the binomial coefficient C(n,p) using standard factorial)r   )r   r   s     r   binor      sK     1WW1::qs##1Q3<<q!!r   commandc                 N   t          |           } t          |           t          u rt          |           dk    s
J d            | \  }}t          |          t          u r|dk    s
J d            t          |          t          u r|dk    s
J d            dt          ||           S )z3parse 'command' as 'n,p' before calling 'bino(n,p)'   zonly two values requiredr   z<n> must be a positive integerz<p> must be a positive integerzbino(n,p) = )parsetypetuplelenintr   )r   r   r   s      r   parserr      s    'NN'	g%		CLLA$5$5$57Q$5$5$5#!A	aCAFFF$DFFF	aCAFFF$DFFF	#Qq			#	##r   __main__zEnter <n>,<p>N)r   )__doc__
__author____version____date__	__usage__ezCLIr   r   r   strr   __name__userloop r   r   <module>r&      s    4 4=
,	     C # C    "3 "# "# " " " "$3 $3 $ $ $ $ z
(6?##### r   