title: The results of python and c++ are different for nested for statements
body: <p>I am writing algorithms in c ++ and python.</p>
  
  <p>The algorithm is to output <code>when n = 7, (0,1,2,3), (0,1,2,4) ... (3,4,5,6)</code> I implemented this through a nested for statement, but the values ​​of c ++ and python are different.</p>
  
  <p>Can you tell me why?</p>
  
  <p>And, for example, when i use for i in range, do i always start at 0? If there is a way to set the initial value of <code>range()</code>, let me know.</p>
  
  <p><strong>C++</strong></p>
  
  <pre><code>for(int i = 0; i &lt; n; ++i)
          for(int j = i+1; j &lt; n; ++j)
              for(int k = j+1; k &lt; n; ++k)
                  for(int l = k+1; l &lt; n; ++l)
                      cout &lt;&lt; i &lt;&lt; " " &lt;&lt; j &lt;&lt; " " &lt;&lt; k &lt;&lt; " " &lt;&lt; l &lt;&lt; endl;
  </code></pre>
  
  <p><strong>Python</strong></p>
  
  <pre><code>for i in range(0, n):
          for j in range(i+1, n):
              for k in range(i+2, n):
                  for l in range(i+3, n):
                      print(i, j, k, l)
  
  </code></pre>