DanielJohnson <[EMAIL PROTECTED]> wrote:

> how to use the combination function in python ?
> 
> For example 9 choose 2 (written as 9C2) = 9!/7!*2!=36
> 
> Please help, I couldnt find the function through help.

If you download and install gmpy, it's easy:

>>> import gmpy
>>> gmpy.comb(9,2)
mpz(36)

However, there's no equivalent function built into Python, if that's
what you're asking (gmpy's a third-party extension).  It's of course
easy to write one for yourself, if you want the functionality but don't
want to download gmpy and don't care for gmpy's superb speed.


Alex

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to