#编写函数 aver(),求 ax2+bx+c=0
import math
def f(a,b,c):
if a==0:
return (“a is not 0”)
else:
delate=bb-4a*c
if delate > 0:
x1=(-b+math.sqrt(delate))/2/a
x2=(-b-math.sqrt(delate))/2/a
return (“two---- first:{:.2f},the second:{:.2f}”.format(x1,x2))
elif delate ==0:
return (“one---- first:{:.2f}”.format(-b/2/a))
else:
return (“none”)
a = eval(input(“please input a:”))
b = eval(input(“please input b:”))
c = eval(input(“please input c:”))
print(f(a,b,c))
初学者编写(大神求指导)