import math
def quadratic(a, b, c): if a!=0: t=(bb)-(4ac) if t<0: return 'eoorr' else: x1=(-b+math.sqrt(t))/(2a) x2=(-b-math.sqrt(t))/(2*a) return x1,x2 else: x1=x2=(-c)/b return x1
缩进确实很麻烦
Sign in to make a reply
土豆拯救世界
-- coding: utf-8 --
import math
def quadratic(a, b, c): if a!=0: t=(bb)-(4ac) if t<0: return 'eoorr' else: x1=(-b+math.sqrt(t))/(2a) x2=(-b-math.sqrt(t))/(2*a) return x1,x2 else: x1=x2=(-c)/b return x1