Created by alain-busser

Created on May 27, 2019

182 Bytes

To solve a (quadratic) equation, means to compute the set of its solutions. This script does exactly that: Compute a set (https://en.wikipedia.org/wiki/Solution_set). It does not compute a list or a string or whatever (else than a set), nor does it display anything, it just solves an equation, giving the set of its solutions. Just enter quadratic_solve(2,5,3) to solve the equation 2x²+5x+3==0

def quadratic_solve(a,b,c):
  S = set([])
  Delta = b**2-4*a*c
  if Delta >= 0:
  return S