title: Why does this stop in Python 33
body: <pre><code>from math import *
  
  def p():
      for a in range (2, 100):   ##for a in range 2 to 100
          for y in range (2, a): ##for y in range 2, 100
              x = 2*a+1          ##x has the following value
              myprimelist = []   ##creating my empty list   
  
              if x &gt; y: 
                  while (x % y != 0):
                      myprimelist.append(x) ##append to list and continue with the same y  until modulo is zero after which it reaches to else
                      y += 1
                      print (x,'nu se imparte egal la',y)
                      return [y]    ##change the y
                  else:
                      y += 1
                      return [y]
              else:
                  a += 1
                  return[a]
          a += 1
          return[a]
  
      print (myprimelist);
  </code></pre>
  
  <p>I'm trying to make a function that will tell me all prime numbers from 2 to 100 but for some reason the loop stops and I don'know why. Please help. Thank you!</p>