我寫了下面的代碼來獲取給定整數數組中唯一的唯一元素。代碼退出狀態255
def lonelyinteger(a):
for x in a:
answer = a.count(x)
if(a.count(x) < 2)
answer=x
return answer
if __name__ == '__main__':
a = input()
b = map(int, raw_input().strip().split(" "))
print lonelyinteger(b)
錯誤
File "solution.py", line 5 if(a.count(x) < 2) ^ SyntaxError: invalid syntax
Exit Status 255
請告訴我在哪裏我想念
喔拍,非常感謝 – NikhilGoud