-9
我的if语句存在问题,我不明白为什么。它是:我的“if语句”语法无效
if (first == 1 and second > -1 and third < 1 and (sign(phi[i]) == sign(phi[i-1]) or sign(phi[i]) == sign(phi[i-2])):
foo()
它一直告诉我"invalid syntax"
。 你能发现无效的语法吗?
我的if语句存在问题,我不明白为什么。它是:我的“if语句”语法无效
if (first == 1 and second > -1 and third < 1 and (sign(phi[i]) == sign(phi[i-1]) or sign(phi[i]) == sign(phi[i-2])):
foo()
它一直告诉我"invalid syntax"
。 你能发现无效的语法吗?
你已经错过了在最后一个括号:
if (first == 1 and second > -1 and third < 1 and (sign(phi[i]) == sign(phi[i-1]) or sign(phi[i]) == sign(phi[i-2]))):
^
压痕。 。 。? –
您的缩进对于初学者来说是错误的。其次,你有什么尝试? – Jeremy
您错过了最后的括号,或者在开始处有太多的括号。投票结束为错字。 – molbdnilo