MySimplePythonApplication is not working What's wrong?
The program outputs: a, not what the Tutorial said I should expect. Code as follows:
import math
__author__ = 'Ralph'
class Solver:
def demo(self) -> object:
"""
:rtype : object #Same result with or without "rtype object"
"""
while True:
a = int(input("a ")) # Program terminates with output: a
b = int(input("b ")) # Same result with (") or (')
c = int(input("c "))
d = b ** 2 - 4 * a * c
if d >= 0:
disc = math.sqrt(d)
root1 = (-b + disc) / (2 * a)
root2 = (-b - disc) / (2 * a)
print(root1, root2)
else:
print('error')
Solver().demo()
Could not get 'code' to 'paste' into 'Attachments'. Any help is appreciated.
import math
__author__ = 'Ralph'
class Solver:
def demo(self) -> object:
"""
:rtype : object #Same result with or without "rtype object"
"""
while True:
a = int(input("a ")) # Program terminates with output: a
b = int(input("b ")) # Same result with (") or (')
c = int(input("c "))
d = b ** 2 - 4 * a * c
if d >= 0:
disc = math.sqrt(d)
root1 = (-b + disc) / (2 * a)
root2 = (-b - disc) / (2 * a)
print(root1, root2)
else:
print('error')
Solver().demo()
Could not get 'code' to 'paste' into 'Attachments'. Any help is appreciated.
Please sign in to leave a comment.