与我的python程序抗争
所以我写这个程序是为了用python进行练习:与我的python程序抗争,python,equation,quadratic,Python,Equation,Quadratic,所以我写这个程序是为了用python进行练习: from math import sqrt Antwoord = 0 while Antwoord != "yes": print "In many cases of Maths there will be a quadratic equation" print "The question is how do you solve it? Through this amazing program" print pr
from math import sqrt
Antwoord = 0
while Antwoord != "yes":
print "In many cases of Maths there will be a quadratic equation"
print "The question is how do you solve it? Through this amazing program"
print
print "These equations comes in a form : ax2 + bx + c"
print "Now lets solve yours!"
eq_a = raw_input("What is your a value?") #Asking values
eq_b = raw_input("What is your b value?")
eq_c = raw_input("What is your c value?")
vierkantsw = (eq_b) ** 2 - 4(eq_a)(eq_c)
teller1 = -(eq_b) + sqrt(vierkantsw) # -b+sqrt((b)**2 -4(a)(c))
teller2 = -(eq_b) - sqrt(vierkantsw) # -b-sqrt((b)**2 -4(a)(c))
noemer = 2 * eq_a # 2(a)
if vierkantsw < 0 :
print "Your equation gives no solution : insolubale" # Vir nie-reele getal
else:
total1 = float(teller1) / noemer # Bereken die twee oplos
total2 = float(teller2 / noemer
print "The two solutions are : " + total1 + " and " + total2
Antwoord = raw_input("Are you finished?") #Vra vir looping
有人能帮我吗
提前谢谢你 您在前一行的“tell2”之后缺少一个结束括号(即“”)。您在前一行的“tell2”之后缺少一个结束括号(即“”)。您在前一行的“tell2”之后缺少一个结束括号(即“”)。您在“tell2”之后缺少一个结束括号(即“)在前一行中。尝试使用
print(“两种解决方案是:“+total1+”和“+total2”)
如果您使用的是python 3…您使用的是python 3.x吗?如果是,则打印的语法已更改为print()
。如果你有语法错误,你应该先用谷歌搜索一下,你不这样认为吗?试试使用print(“这两种解决方案是:“+total1+”和“+total2”)
如果你使用的是Python3…你使用的是Python3.x
?如果是,则打印的语法已更改为print()
。如果你有语法错误,你应该先用谷歌搜索一下,你不这样认为吗?试试使用print(“这两种解决方案是:“+total1+”和“+total2”)
如果你使用的是Python3…你使用的是Python3.x
?如果是,则打印的语法已更改为print()
。如果你有语法错误,你应该先用谷歌搜索一下,你不这样认为吗?试试使用print(“这两种解决方案是:“+total1+”和“+total2”)
如果你使用的是Python3…你使用的是Python3.x
?如果是,则打印的语法已更改为print()
。如果你有语法错误,你不觉得应该先用谷歌搜索吗?
print "The two solutions are : " + total1 + " and " + total2
^
SyntaxError: invalid syntax