Project Euler

Prime List Generator

      
      def prime_list(x):
        #create an array of primes for all numbers less than x
        primes = [2]

        for i in range(3,x,2):
          for j in range(2,int(i**0.5)+1):
            if i % j == 0:
              break
          else:
            primes.append(i)

        return primes