Quadratic2

Solve any quadratic equation, with real or "imaginary" roots
import math import sys a = float(sys.argv[1]) b = float(sys.argv[2]) c = float(sys.argv[3]) discriminant = b**2 - 4 * a * c if discriminant >= 0: x1=(-b+math.sqrt(discriminant))/2*a x2=(-b-math.sqrt(discriminant))/2*a else: x1= complex((-b/(2*a)),math.sqrt(-discriminant)/(2*a)) x2= complex((-b/(2*a)),-math.sqrt(-discriminant)/(2*a)) if discriminant > 0: print("The function has two real roots: {} and {}".format(x1,x2)) elif discriminant == 0: print("The function has one double root: {}".format(x1)) else: print("The function has two complex roots: {} and {}".format(x1,x2))
 * 1) !/usr/bin/python