Skip to content

Instantly share code, notes, and snippets.

@jasonsperske
Last active December 12, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonsperske/4773977 to your computer and use it in GitHub Desktop.
Save jasonsperske/4773977 to your computer and use it in GitHub Desktop.
from math import pow
from cmath import sqrt
print "Quadradtic Formula Calculator!!!"
print "Ax²+Bx+C=0"
print "This solve for x"
a = input("Please, enter value for A: ")
b = input("Please, enter value for B: ")
c = input("Please, enter value for C: ")
discriminant = sqrt(pow(b,2) - (4 * a * c))
if discriminant.imag != 0:
print "discriminant is imaginary"
else:
print " Solution 1!!!:", (-b + discriminant.real) / (2 * a)
print " Soultion 2!!!:", (-b - discriminant.real) / (2 * a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment