We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8840fbf commit 39e942bCopy full SHA for 39e942b
1 file changed
Equation.py
@@ -0,0 +1,12 @@
1
+import cmath
2
+a = float(input('Enter a: '))
3
+b = float(input('Enter b: '))
4
+c = float(input('Enter c: '))
5
+
6
+# calculate the discriminant
7
+d = (b**2) - (4*a*c)
8
9
+# find two solutions
10
+sol1 = (-b-cmath.sqrt(d))/(2*a)
11
+sol2 = (-b+cmath.sqrt(d))/(2*a)
12
+print('The solution are {0} and {1}'.format(sol1,sol2))
0 commit comments