Don't write better error messages, write code that doesn't need them.
Search
Search
Login
Register
Home
Articles
Snippets
Topics
My Likes
My Favourites
Python Solve Quadratic Equation
Language
Python (3.8.1)
# quadratic equation: ax**2 + bx + c = 0 import cmath a = 1 b = 4 c = 9 d = (b**2) - (4*a*c) sol1 = (-b-cmath.sqrt(d))/(2*a) sol2 = (-b+cmath.sqrt(d))/(2*a) print('The solution are: {0} and {1}'.format(sol1,sol2))
Run Code
* Temp disabled. Under development!
IDE
The solution are: (-2-2.23606797749979j) and (-2+2.23606797749979j)
Execution time:
0.018 sec.
Info
Language:
Python (3.8.1)
Shared By:
Md Obydullah
Expiration Time:
02 May 2022, 04:27:38
Link:
Copy
plz wait...