title: List index out of range every time i use if?
body: <pre><code>v = [1, 3, 5, 6, 8, 10]
  
  f = [2, 4, 7, 9, 11, 12]
  
  def new(v,f):
  
      i = 0
      j = 0
      u=[0]*12
      for k in range(12):
            if(v[i]&lt;=f[j]):
                u[k]+=v[i]
                i+=1
            elif(f[j]&lt;=v[i]):
                   u[k]+=f[j]
                   j+=1
      print(u)
  new(v, f)
  </code></pre>
  
  <p>Traceback (most recent call last):</p>
  
  <p>File "C:/Users/Matheus/PycharmProjects/untitled/dsfdsfs.py", line 15, in </p>
  
  <pre><code>new(v, f)
  </code></pre>
  
  <p>File "C:/Users/Matheus/PycharmProjects/untitled/dsfdsfs.py", line 8, in new</p>
  
  <pre><code>if(v[i]&lt;=f[j]):
  </code></pre>
  
  <p>IndexError: list index out of range</p>
  
  <p>I cant figure the reason of this error</p>