import math # This will import math module print "Square Completer by Hez" print "~Equations must be in format ax+bx^2+c=0~" print "If a subtraction in necessary, please input negative integer" print " " *20 a = int(raw_input("Enter 'a' value:" )) b = int(raw_input("Enter 'b' value:" )) c = int(raw_input("Enter 'c' value:" )) val0 = 0 if a <> 1: a = a/a b = b/b c = c/c if c <> (b/2)*(b/2): print " Not perfect square" else: valXpos = math.sqrt(-c) + [(b/2)*(b/2)] valXneg = math.sqrt(-c) - [(b/2)*(b/2)] print "x is equal to " + valXpos + " OR x is equal to " + valXneg
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question