title: maximum recursion depth exceeded in comparison
body: <p>I wrote this piece of code to compute the number of combinations:</p>
  
  <pre><code>def fact(n):
      return 1 if(n == 1) else n * fact(n - 1)
  
  def combinations(n,k):
      return fact(n)/((fact(n - k) * fact(k)))
  
  while(True):
      print(combinations(int(input()), int(input())))
  </code></pre>
  
  <p>The factorial function seems to work fine. But why does it give me a maximum recursion depth exceeded in comparison error when I try to find the combinations of two numbers? Is there something wrong with the factorial function, since that's where the error seems to be originating from?</p>
  
  <p>This was the error I got:</p>
  
  <blockquote>
    <p>builtins.RuntimeError: maximum recursion depth exceeded in comparison</p>
  </blockquote>