+ 1

Pls someone should guide me on how to go about writing quadratic equation using PERMDAS with python

Quadratic equation(Top urgent)

18th May 2023, 7:36 PM
Ojimadu Chinaza Joy
Ojimadu Chinaza Joy - avatar
3 Answers
+ 1
Show us your work so far, and we can help. If you've got nothing, get to work.
18th May 2023, 8:06 PM
Orin Cook
Orin Cook - avatar
+ 1
To write a quadratic equation using the PERMDAS (Parentheses, Exponents, Multiplication and Division, Addition and Subtraction) principle in Python, you can use the following code: import math def quadratic_equation(a, b, c): x1 = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a) x2 = (-b - math.sqrt(b**2 - 4*a*c)) / (2*a) return x1, x2 # Example a = 1 b = -3 c = 2 result = quadratic_equation(a, b, c) print("The solutions of the quadratic equation are:", result) In this code, the quadratic_equation function uses the formula (-b ± √(bÂČ - 4ac)) / 2a to calculate the two solutions of the quadratic equation. The math.sqrt() function is used to calculate the square root. The result is returned as a tuple and then printed. Please note that the variable a should not be zero, as it would lead to division by zero.
18th May 2023, 8:07 PM
Jan Markus
0
Thank you
18th May 2023, 8:20 PM
Ojimadu Chinaza Joy
Ojimadu Chinaza Joy - avatar