-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