Marbles, could you please tell me what's wrong in this code i tried several times but i couldn't figure it out

cook your dish here

def fact(n):
res = 1;
for i in range(1,n+1):
res = res *i;
return res;

def nCr(n,k):
return (fact(n)/(fact(n-k) * fact(k)))

t = int(input());
while(t):
n, k = map(int, input().split())
print(int(nCr(n-1,k-1)));
t = t-1;

You cannot directly calculate nCr by fact(n) because it would exceed the range of data type, instead you would have to calculate it by iterating over the value of r and each time dividing by the value of r if possible.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.