Created
April 28, 2017 16:54
-
-
Save JellyWX/a2eca8a8b081a733a6be2cdcdd09fe50 to your computer and use it in GitHub Desktop.
A Python 3 script to solve complete the square questions and solve quadratics.
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
import math | |
print('Enter your equation, which should be in the format ax^2 + bx + c') | |
a = int(input('Enter the `a` value')) | |
b = int(input('Enter the `b` value')) | |
c = int(input('enter the `c` value')) | |
b = b/a | |
c = c/a | |
b2 = -1*(b/2) | |
c2 = abs(c - (b2**2)) | |
print(str(b2) + ' +/- sqrt' + str(c2) + ' = x') | |
ans1 = b2 + math.sqrt(c2) | |
ans2 = b2 - math.sqrt(c2) | |
print('answers: \n' + str(ans1) + '\n' + str(ans2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment