7、.def main(): 5. print("Thisprogram finds the real solutions to a quadratic") 6. a,b,c =eval(input("Please enter the coefficients(a,b,c): ")) 7. delta = b*b -4*a*c 8. if delta >= 0: 9. discRoot =math.sqrt(delta) 10. root1 =
8、 (-b +discRoot) / (2*a) 11. root2 = (-b -discRoot) / (2*a) 12. print("The solutions are:", root1, root2) 13. else: 14. print("Theequation has no real roots!") 15.main() 【运行结果】输出