← Back to challenges

Finding the Center and Radius of a Circle

PythonHardalgebramathgeometry

Instructions

The general form of the equation of a circle is x²+y²+ax+by+c=0 where a, b, and c are constants.

Create a function that takes numbers a, b and c as arguments, and returns a list [(x_c, y_c), r] where (x_c, y_c) is the center and r is the radius.

Examples

circle(-4, -6, -12) ➞ [(2, 3), 5]

circle(8, -2, -32) ➞ [(-4, 1), 7]

circle(16, 4, 67) ➞ [(-8, -2), 1]

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.