Ad
Code
Diff
  • def primemaker(x):
        if x<2: return []
        primes = [2]
        for possibleprimes in range(3,x+1, 2):
            for n in range(2,int(possibleprimes**0.5)+1):
                if possibleprimes % n == 0:
                    break
            else:
                primes.append(possibleprimes)
        return primes
    • def primemaker(x):
    • primes = []
    • isprime = True
    • for possibleprimes in range(2,x):
    • for n in range(2,possibleprimes):
    • if possibleprimes % num == 0:
    • isprime = False
    • if isprime:
    • if x<2: return []
    • primes = [2]
    • for possibleprimes in range(3,x+1, 2):
    • for n in range(2,int(possibleprimes**0.5)+1):
    • if possibleprimes % n == 0:
    • break
    • else:
    • primes.append(possibleprimes)
    • print(primes)
    • return primes