The Newton method is a numerical method, but your f(x) and g(x) as they are remain symbolic. You need to evaluate them. With the following changes, the code ran in my computer. But since I don't see and expected output I cannot attest it runs as you expected.
# Compute the determinant of the matrix A
det1 = A.det()
ddet=diff(det1,x)
# Defining Function
def f(xvalue):
return det1.subs({x : xvalue})
# Defining derivative of function
def g(xvalue):
return ddet.subs({x : xvalue})