Last active
May 8, 2018 08:35
-
-
Save c272/65e7eeeb3e168a3e06a1513960d1d8c8 to your computer and use it in GitHub Desktop.
Quadratic Formula in Python 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Quadratic formula import, Python 3.6 | |
| #C272, 2018 | |
| from math import * | |
| def solveQuad(a,b,c): | |
| a = float(a) | |
| b = float(b) | |
| c = float(c) | |
| rootb = sqrt(b) | |
| bsq = b**2 | |
| ans = ["",""] | |
| ans[0] = (-b + sqrt(bsq-(4*a*c)))/(2*a) | |
| ans[1] = (-b - sqrt(bsq-(4*a*c)))/(2*a) | |
| return ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment