(Solved) : 6 Import Math 7 10 12 13 14 15 16 17 18 8 True Input Enter Vallue Checks Enter Pressed Ter Q44109422 . . .
This is my current code^
it needs to be modified to fit the credentials below.
6 import math 7 10 12 13 14 15 16 17 18 8 while True: a=input(“Enter a vallue for a:”) if(a==””): #this checks if enter is pressed in the terminal to quit. 11 break else: a=float(a) #converting the value of a if enter is not pressed. b=input(“Enter a value for b:”) b=float(b) #converting the value of b to float. c=input(“Enter a value for c:”) c=float(c) #converting the value of c. if(b*b-4*a* c < 0): #checking the first condition print(“no real solutions”) elif(b*b-4*a*c == 0): x=-b/2*a #if the condition is equal -b/2a will be left. x=str(x) #we need to convert the float back to string or the compiler throws error print(“one solution:”+x) elif(b*b-4*a*c>0): x1=(-b+math.sqrt(b*b-4*a*c))/2*a #just using the formula to compute the value x1=str(x1) #converting it back to string. x2=(-b-math.sqrt(b*b-4*a*c))/2*a 28 x2=str(x2) print(“two solutions:”+x1+”, “+x2) #printing the two values. 2e 27 23 2A 25 26 To keep the problem simple we can assume that the user never enters a value for coefficient a that is equal to 0. To stop the loop and end the program the user just types the ENTER key instead of the string for coefficient a. 2. Within the main loop, after printing the values of the real solutions (if any) to the terminal the program displays the graphic of the quadratic function y=axⓇ+bx+c using the matplotlib.pyplot module. The chart should use 150 points. • If the function has real roots (one or two) make sure the roots are visible on the chart. E.g. if the roots are -1 and 3 use a domain interval for values x (on the Ox axis) that includes -1 and 3, like [-3, 5]. If the function has no real roots, then center the function domain (x values) on the function’s -1 minimum or maximum value, which is Xopt=_=. Pick your own approach to select the function’s domain while complying with the above requirements. 2a Show transcribed image text 6 import math 7 10 12 13 14 15 16 17 18 8 while True: a=input(“Enter a vallue for a:”) if(a==””): #this checks if enter is pressed in the terminal to quit. 11 break else: a=float(a) #converting the value of a if enter is not pressed. b=input(“Enter a value for b:”) b=float(b) #converting the value of b to float. c=input(“Enter a value for c:”) c=float(c) #converting the value of c. if(b*b-4*a* c 0): x1=(-b+math.sqrt(b*b-4*a*c))/2*a #just using the formula to compute the value x1=str(x1) #converting it back to string. x2=(-b-math.sqrt(b*b-4*a*c))/2*a 28 x2=str(x2) print(“two solutions:”+x1+”, “+x2) #printing the two values. 2e 27 23 2A 25 26
To keep the problem simple we can assume that the user never enters a value for coefficient a that is equal to 0. To stop the loop and end the program the user just types the ENTER key instead of the string for coefficient a. 2. Within the main loop, after printing the values of the real solutions (if any) to the terminal the program displays the graphic of the quadratic function y=axⓇ+bx+c using the matplotlib.pyplot module. The chart should use 150 points. • If the function has real roots (one or two) make sure the roots are visible on the chart. E.g. if the roots are -1 and 3 use a domain interval for values x (on the Ox axis) that includes -1 and 3, like [-3, 5]. If the function has no real roots, then center the function domain (x values) on the function’s -1 minimum or maximum value, which is Xopt=_=. Pick your own approach to select the function’s domain while complying with the above requirements. 2a
Expert Answer
Answer to 6 import math 7 10 12 13 14 15 16 17 18 8 while True: a=input(“Enter a vallue for a:”) if(a==””): #this checks if enter …
OR