Discuss / Python / 请各位看看这个程序错在哪里了啊?

请各位看看这个程序错在哪里了啊?

Topic source
在此插入代码

-- coding: utf-8 --

import math def quadratic(a,b,c): if not isinstance(a,(int,float)): raise TypeError('Error,a') if not isinstance(b,(int,float)): raise TypeError('Error!,b') if not isinstance(c,(int,float)): raise TypeError('Error,c') print('%dx2+%dx+%d'%(a,b,c))
if a=0: x1=-c/b; z=(b
2-4ac) if z<0: print('无实数根') elif z>0: x1=(-b+math.sqrt(z))/(2a) x2=(-b-math.sqrt(z))/(2a) return x1,x2 else: x1=-c/b return x1

请问我这个哪里出问题了?运行的时候都会提示 File "C:\Work\yiyuanerci.py", line 11 if a=0: ^ SyntaxError: invalid syntax

One-Byte

#2 Created at ... [Delete] [Delete and Lock User]
 if a==0:

对,就是这个, if a==0:


  • 1

Reply