CS377: Database Design - Quadratic Formula in Python (3 Points)
Developed by Professor Tralie and Professor Mongan.Exercise Goals
The goals of this exercise are:- To write mathematical expressions in Python
- To write a function that computes an expression and returns its result
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
Welcome to our online modules system!
Be sure to log in with your Urinus ID
before you proceed.
For example, Professor Tralie's ID is ctralie.
If you are not an Ursinus student, that's fine!
Just make something up, and you can still run everything
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:
\[\frac{-b + \sqrt{(b^{2} - 4ac)}}{2a}\]
Attribution
Developed by Prof. Chris Tralie