title: IndexError: list index out of range Why?
body: <p>I know that this question has been answered so many times, but I can't figure out where my issue is. This is my code:</p>
  
  <pre><code>from random import*
  
  def VerificationLongue():
  
      x=randint(0,1000)
      liste=CreerListe()
      Check=0
      i=0
  
      while i&lt;=len(liste):
          if x==liste[i]:
              Check=Check+1
          i=i+1
  
      print("X est dans la liste",Check," fois")
  
  def CreerListe(): 
      ListeAleatoire=[]
      for i in range (0,100):
          valeur=randint(0,1000)
          ListeAleatoire.append(valeur)
      return (ListeAleatoire)
  
  
  VerificationLongue()
  </code></pre>
  
  <p>This is a simple algorithm to find if a number is in a list of random numbers. I know there is function such 'count', or 'in' but this is for school and they don't want us to use them. So there is the error I get:</p>
  
  <pre><code>line 11, in VerificationLongue
      if x==liste[i]:
  IndexError: list index out of range
  </code></pre>
  
  <p>I don't know why there is this error because it is initialized to 0.</p>