CS377: Database Design - Quadratic Formula in Python (3 pts)
Explorer
GitHub
Connect to GitHub to push and pull your project files to a repository.
On the page that opens, create a token with repo scope, copy it, then paste it below.
Paste the personal access token you created on GitHub with repo scope.
Click Refresh to load commit history
Exercise Info
Goals
To write mathematical expressions in Python
To write a function that computes an expression and returns its result
Instructions
Write a function that computes one of the roots of a quadratic equation. In addition to multiplying b by itself, you can compute b*b using the b** with the ** operator. The math.sqrt() method takes a single parameter, which is the number whose root should be computed, and returns the result. Now complete the code to compute one of the roots of the quadratic formula
Quadratic Formula
For reference, the quadratic formula is:
\[\frac{-b \pm \sqrt{(b^{2} - 4ac)}}{2a}\]
given an equation:
\[ax^{2} + bx + c = 0\]
In this exercise, you can simply compute one of the roots, as follows: