a function called find_roots that takes three numbers (????, ????, and????)andfindtherootsofthequadratic equationintheform???????? 2 + ???????? + ????
Fantastic news! We've Found the answer you've been seeking!
Question:
a function called "find_roots" that takes three numbers (????, ????, and ????) and find the roots of the quadratic equation in the form ????????2 + ???????? + ???? = 0
For example:
Input -> a=2, b=10, c=8
Output -> ("The first root is: " −1, "The second root is: " −4)
Your algorithmshould have the followings:
- [2 Marks]Take three inputs from the user (????, ???? and ????)
- [3 Marks] A functionto find the roots called"find_roots"
- [10 Marks] Calculate a variable called "delta" inside the function with the following formula:????2 − 4????????
- [10 Marks]Find two roots using the formula: ????
= −????+√delta and???? =
−????−√delta 2????
1 2???? 2
(Hint: for square root use ????????????ℎ.????????????????(????????????????????????????????????????))
- [5 Marks]Returns a tuple with the following elements:
("The first root is: " 1>, "The second root is: " 2>)
Related Book For
Posted Date: