def quadratic_roots(a,b,c):
if not (type(a)==int or type(a)==float) and (type(b)==int or type(b)==float)\
and (type(c)==int or type(c)==float):
print("Error. Must be numbers.")
return None
equation=(b**2)-(4*a*c)
realRoots=[]
if equation<0:
return realRoots
elif equation==0:
x1=-b/(2*a)
#realRoots.append(x)
return [x1]
else:
x1=(-b+((equation)^(1/2))/(2*a)
x2=(-b-((equation)^(1/2))/(2*a)
return realRoots.append(x1,x2)
我需要將我的二次方根放入列表中,但我不斷收到語法錯誤。我如何編輯我的代碼,以便它能正常工作?將二次方根置於列表中