Returning binomal as a tuple

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-01-31T21:37:30Z Indexed on 2010/12/24 19:54 UTC
Read the original article Hit count: 143

Filed under:
|
|

I want to save the results of my function binomal_aux to a tuple but I don't have an idea how to, here is my code I have right now.

def binomal (n):    
    i=0
    for i in range(n):
        binomal_aux(n,i) #want this to be in a tuple so, binomal (2) = (1,2,1)
    return

def binomal_aux (n,k):
    if (k==0):
        return 1
    elif (n==k):
        return 1
    else:
        return (binomal_aux(n-1,k) + binomal_aux(n-1,k-1))

© Stack Overflow or respective owner

Related posts about python

Related posts about recursion