# 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
**Enter your Ursinus netid before clicking run. This is not your ID number or your email. For example, my netid is wmongan (non Ursinus students can simply enter their name to get this to run, but they won't get an e-mail record or any form of credit).**

Netid |

**You must be connected to the VPN for submission to be successful! You will receive a copy of your code via e-mail, so you'll know that it was submitted if you receive that e-mail!**VPN access requires Multi-Factor Authentication, which sends you a code when you log into the network. Instructions on configuring these for your account can be found here.

### quadratic.py

import math
def get_quadratic_roots(a, b, c):
"""
Compute the right root of of the quadratic equation
f(x) = ax^2 + bx + c
"""
return 0 # This is a default value

### main.py

# Run some tests on the method
print(get_quadratic_roots(1, -1, -6), end=',')
print(get_quadratic_roots(1, 0, -1))

### Output

## 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