Problem 44 Quadratic Raising Error Exercise Use Sqrt Function Imported Math Consider Progr Q43803426
Language : Python

Problem 4.4. Quadratic with raising Error In this exercise, use the sqrt function imported from math. Consider the program from Problem 4.1. Not all inputs yield real solutions. Modify the program such that it raises ValueError if the values for a, b and c yield complex roots. (That is if b2 – 4ac < 0). Provide a suitable Error-message. Test that your program prints out real roots and that it raises ValueError when the roots are complex. (An example of values that provide complex roots could be a = 1, b = 1, c= 1, while a = 1, b = 0, c= -1 provide real roots). Filename: quadratic roots_error2.py Show transcribed image text Problem 4.4. Quadratic with raising Error In this exercise, use the sqrt function imported from math. Consider the program from Problem 4.1. Not all inputs yield real solutions. Modify the program such that it raises ValueError if the values for a, b and c yield complex roots. (That is if b2 – 4ac
Expert Answer
Answer to Problem 4.4. Quadratic with raising Error In this exercise, use the sqrt function imported from math. Consider the progr…
OR