import click
import math
print("solver.py in python2.7")
class Solver:
def demo(self):
print("Resolve second degree equation. Enter the coefficients(numbers): a,b,c")
text = raw_input(' Are you ready: y/n ? ')
print('you entered: ', text)
text = "y"
while (text == 'y'):
# while True:
a = float(input("a "))
b = float(input("b "))
c = float(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('This equation has no roots')
print('do you want to begin again for another equation ? ')
#text = raw_input(' y/n ? ')
#print("you entered: ", text)
click.echo('Do you agree ? y/n ', nl=False)
text= click.getchar()
click.echo()
if text == b'y':
click.echo('We wiil continue')
elif text == b'n':
click.echo('Abort!')
exit()
else:
click.echo('Invalid input ! ')
exit()
sylvain@sylvain-HP-Laptop-15-bw0xx:~$ python solver.py
File "solver.py", line 29
click.echo'Do you agree ? y/n '
^
IndentationError: unexpected indent
sylvain@sylvain-HP-Laptop-15-bw0xx:~$ pip -V
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
I am on Linux. All my problems should disappear if I could easily make python3 the default language.
import math
print("solver.py in python2.7")
class Solver:
def demo(self):
print("Resolve second degree equation. Enter the coefficients(numbers): a,b,c")
text = raw_input(' Are you ready: y/n ? ')
print('you entered: ', text)
text = "y"
while (text == 'y'):
# while True:
a = float(input("a "))
b = float(input("b "))
c = float(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('This equation has no roots')
print('do you want to begin again for another equation ? ')
#text = raw_input(' y/n ? ')
#print("you entered: ", text)
click.echo('Do you agree ? y/n ', nl=False)
text= click.getchar()
click.echo()
if text == b'y':
click.echo('We wiil continue')
elif text == b'n':
click.echo('Abort!')
exit()
else:
click.echo('Invalid input ! ')
exit()
sylvain@sylvain-HP-Laptop-15-bw0xx:~$ python solver.py
File "solver.py", line 29
click.echo'Do you agree ? y/n '
^
IndentationError: unexpected indent
sylvain@sylvain-HP-Laptop-15-bw0xx:~$ pip -V
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
I am on Linux. All my problems should disappear if I could easily make python3 the default language.