title: Python. How to remove zeroes from a list in Python
body: <pre><code>X = [0,5,0,0,3,1,15,0,12]
  
  for value in range(0,len(X)):
  
      if X[value] &lt;= 0:
          del X[value]
          print(X)
  print(X)
  </code></pre>
  
  <p>I run the code but then i get an error saying that the list is out of index range.
  Can someone please help me out on how to correct this mistake</p>