Write quadratic_roots(a, b, c) that returns the real solutions of a*x**2 + b*x + c = 0 as a list sorted from smallest to largest, each rounded to 2 decimal places. Return [] if there are no real roots and a one-element list if the two roots coincide.
Examples
Input: a = 1, b = -3, c = 2
Output: [1.0, 2.0]
Input: a = 1, b = 2, c = 1
Output: [-1.0]
Input: a = 1, b = 0, c = 1
Output: []
Constraints
a != 0; all coefficients are ints or floats with absolute value at most1000
Goals
- Branch on the sign of the discriminant
- Return a list whose length depends on the input
- Round and sort floating-point results