Ask Your Question

Revision history [back]

Some of the code you wrote didn't make it. You should indent code so that it is displayed properly.

I don't exactly understand your algorithm, but from what I can grasp it might be something like this.

def update_basis(G,h):
    G_old = G.copy()
    G_new = []
    while G_old:
        g = G_old.pop()
        if ht(h) % ht(g):
            G_new.append(g)
    G_new.append(h)
    return G_new