title: how to fix reduce() of empty sequence with no initial value error?
body: <p>When I am trying to find factorial using below code, it is working for all numbers except '0'. When I give the input as 0, below error is displayed. Can some one help me to understand and fix the error</p>
  
  <pre><code>from functools import reduce
  
  n = int(input())
  fact = lambda a, b: a*b if (n&gt;=1) else 1
  reduce(fact, range(1,n+1))
  </code></pre>
  
  <p>Expected result: When input is given as '0' 1 should be displayed as output</p>
  
  <p>Actual result: Below error is displayed</p>
  
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)    
  &lt;ipython-input-124-52f472210976&gt; in &lt;module&gt;    
        3     
        4 fact = lambda a, b: a*b if (n&gt;=1) else 1    
  ----&gt; 5 reduce(fact, range(1,n+1))    
        6 
  
  TypeError: reduce() of empty sequence with no initial value
  </code></pre>