From 6f9fb982c348e9cb2f412fc9e4f6e53fa2014cea Mon Sep 17 00:00:00 2001 From: ant19997x <72279868+ant19997x@users.noreply.github.com> Date: Fri, 2 Oct 2020 19:08:44 -0700 Subject: [PATCH] Quadratic Formula Takes the values of a,b,c, and calculates the two solutions for the quadratic equation ax^2 + bx + c = - --- Quadratic formula | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Quadratic formula diff --git a/Quadratic formula b/Quadratic formula new file mode 100644 index 0000000..a0b20fd --- /dev/null +++ b/Quadratic formula @@ -0,0 +1,11 @@ +import cmath + +print('Solve the quadratic equation: ax**2 + bx + c = 0') +a = float(input('Please enter a : ')) +b = float(input('Please enter b : ')) +c = float(input('Please enter c : ')) +delta = (b**2) - (4*a*c) +solution1 = (-b-cmath.sqrt(delta))/(2*a) +solution2 = (-b+cmath.sqrt(delta))/(2*a) + +print('The solutions are {0} and {1}'.format(solution1,solution2))