求大神指教
运算成功了,但不知道为什么结果是浮点数,里面数字都没浮点数,这是为什么?
import math def quadratic_equation(a, b, c): t = math.sqrt(b * b - 4 * a * c) return (-b + t) / (2 * a),( -b - t )/ (2 * a) print quadratic_equation(2, 3, 0) print quadratic_equation(1, -6, 5)
运算成功了,但不知道为什么结果是浮点数,里面数字都没浮点数,这是为什么?
import math def quadratic_equation(a, b, c): t = math.sqrt(b * b - 4 * a * c) return (-b + t) / (2 * a),( -b - t )/ (2 * a) print quadratic_equation(2, 3, 0) print quadratic_equation(1, -6, 5)
2017-11-21
举报