Please write the algorithm for the sieve of Eratosthenes in Python code.
Here is a Python implementation of the Sieve of Eratosthenes algorithm:

def sieve_of_eratosthenes(n):
    # create a list of all numbers from 2 to n
    numbers = [x for x in range(2, n+1)]

    # loop up to the square root of n
    for i in range(2, int(n**0.5)+1):
        # if i is in the list, then remove all its multiples from the list
        if i in numbers:
            for j in range(i**2, n+1, i):
                if j in numbers:
                    numbers.remove(j)

    # all remaining numbers in the list are prime
    return numbers