# Revision history [back]

### why this algorithm does not work?

Hello I'm trying to write this algorithm in sage:

def roots(f, q):

# return list of roots of f in finite field of q elements

K.<t> = GF(q)

r = [ ]

g = qq2zz(f).change_ring(K)

for a in K:

if g(a) == 0:

r.append(a)

return r

but i get error, it says that:

Traceback (click to the left of this block for traceback ) ....

how should I correct it?

 2 No.2 Revision tmonteil 25448 ●29 ●181 ●474 http://wiki.sagemath.o...

### why this algorithm does not work?

Hello I'm trying to write this algorithm in sage:

def roots(f, q): q):
# return list of roots of f in finite field of q elements K.<t> elements
K.<T> = GF(q) GF(q)
r = [ ] ]
g = qq2zz(f).change_ring(K) qq2zz(f).change_ring(K)
for a in K: K:
if g(a) == 0: r.append(a) 0:
r.append(a)
return rr


but i get error, it says that:

Traceback (click to the left of this block for traceback ) ........


how should I correct it?

 3 No.3 Revision tmonteil 25448 ●29 ●181 ●474 http://wiki.sagemath.o...

### why this algorithm does not work?

Hello I'm trying to write this algorithm in sage:

def roots(f, q):
# return list of roots of f in finite field of q elements
K.<T> = GF(q)
r = [ ]
g = qq2zz(f).change_ring(K)
for a in K:
if g(a) == 0:
r.append(a)
return r


but i get error, it says that:

Traceback (click to the left of this block for traceback ) ....


how should I correct it?