Last active
April 28, 2017 16:58
-
-
Save JellyWX/73ea777f4582f5270e5bb62e2d884636 to your computer and use it in GitHub Desktop.
Python3 Quadratic Formula Calculator
This file contains 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
#This script is for calculating quadratic equations in the form ax^2 + bx + c = 0. The answer to the equation MUST BE 0. To rearrange it, simply subtract one side from the other. Enjoy! | |
from math import sqrt | |
print('Enter values for a, b and c (ax^2 + bx + c = 0) by each in when prompted and pressing enter.') | |
a = int(input('a=')) | |
b = int(input('b=')) | |
c = int(input('c=')) | |
d = ((-1*b) + sqrt((b**2) - (4*a*c)))/(2*a) | |
e = ((-1*b) - sqrt((b**2) - (4*a*c)))/(2*a) | |
print('x is equal to' + str(d) + ', ' + str(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment