Nov-07-2019, 04:50 PM
(Nov-07-2019, 09:25 AM)MathisDELAGE Wrote: I'd like to fix an equation with this program is what it would be possible to please
Hi!
I don't see the equation(s) you want to fix.
I would approach the issue in a different way, for instance:
import math aValue = float(input("Please, for the equation type:\nax\u00b2 + bx + c = 0\nenter the value of coefficient 'a':\n")) bValue = float(input("Please, for the equation type:\nax\u00b2 + bx + c = 0\nenter the value of coefficient 'b':\n")) cValue = float(input("Please, for the equation type:\nax\u00b2 + bx + c = 0\nenter the value of coefficient 'c':\n")) d = (bValue**2) - (4*aValue*cValue) sol1 = (-bValue-math.sqrt(d))/(2*aValue) sol2 = (-bValue+math.sqrt(d))/(2*aValue) print(f'The solutions are x1 = {sol1} and x2 = {sol2}.')and for the sample equation 'x² - x - 2 = 0', it would produce the following output:
Output:Please, for the equation type:
ax² + bx + c = 0
enter the value of coefficient 'a':
1
Please, for the equation type:
ax² + bx + c = 0
enter the value of coefficient 'b':
-1
Please, for the equation type:
ax² + bx + c = 0
enter the value of coefficient 'c':
-2
The solutions are x1 = -1.0 and x2 = 2.0.
>>>
All the best,
newbieAuggie2019
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs