about | help | code help+videos | done | prefs |
The general form of a quadratic equation is a*x^2 + b*x + c = 0. Define a function that when passed the coefficients a, b and c and a fourth boolean attribute flag, returns, 1. None, if no solution exists; 2. the higher of the two roots of the equation, if flag is True and solution exists; 3. the smaller of the two roots of the equation, if flag is False and solution exists. You can use the built-in max(), min() and math.sqrt() functions. NOTE: The challenge of this question is in the research and not the implementation. quadratic_solution(1, -3, 2, True) → 2.0 quadratic_solution(1, -3, 2, False) → 1.0 quadratic_solution(1, 10, 24, True) → -4.0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 3 Post-solution available
Copyright Nick Parlante 2017 - privacy