title: why we are using range(len(A) +1) instead of (len(A)) in python
body: <p>Please help to understand the use of (len(A)+1) in below Python Code Sample</p>
  <pre><code>def printsublist(A): 
     result = [[ ]]  
     for i in range(len(A) + 1):   
        for j in range(i + 1, len(A) + 1):         
           sub = A[i:j] 
           result.append(sub) 
     return result
  
  # Driver Code
  list = [4,5,6]
  print(printsublist(list))
  
  </code></pre>
  <p>output : [[], [4], [4, 5], [4, 5, 6], [5], [5, 6], [6]]</p>