Jeisa
Member
- May 4, 2011
- 112
- 2
I've made this program that solves quadratic equations, but I am stuck when the discriminant is negative, i want my program to say
is there a code that i can use when answer is negative for it to stop? like
That is the error I get, after my discriminant is negative!
Help please?
Thanks
EDIT 5/31/11: Everything is fixed and running, all I need is to convert it into an exe. Any ideas? I already tried py2exe but doesnt work for me :/
Code:
print 'Discriminant is negative, there are no roots, done!'
Code:
if ans == -ans:
print 'No roots'
Code:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
start()
File "C:\Users\Home\Desktop\python\quadraticequation.py", line 17, in start
ansadd=-b+dis**.5
ValueError: negative number cannot be raised to a fractional power
That is the error I get, after my discriminant is negative!
Help please?
Thanks
EDIT 5/31/11: Everything is fixed and running, all I need is to convert it into an exe. Any ideas? I already tried py2exe but doesnt work for me :/