NZEC error.

Hi,
I always recieve a non zero exit code?
Why is that happening?
Could someone look at my code?

def fact(n):#factorial function
    if(n==0):
	    return 1
     return(n*fact(n-1))


def coeff(n,k):#binomial coefficient
    return(fact(n)/fact(k)/fact(n-k))



#define {0,1,2...2^n-1} as range(2**n)

def compute(n,r):
    #what in given set matches criteria
    cr=[]	
    for k in range(2**n):
	    if((coeff(((2**n)-1),k))%(2**n))==r:
		    cr.append(k)
    #now compute minimum and return value
    if(len(cr)>0):
	    return min(cr)
    else:
	    return -1

    def main():
    #no of test cases:-
    t=input()

    for i in range(t):
              a=raw_input()
	      a=a.split(' ')
	      print compute(int(a[0]),int(a[1]))
    return 0
main()

i think in defcoeff method you have not provided the base case. and so you are getting nzec.

//