我不斷收到一個語法錯誤與下面的代碼行:我不斷收到一個語法錯誤
# If the user asked for celsius then x will be a Celsius number converting to Fahrenheit number
if x = = c
你有什麼想法?
我不斷收到一個語法錯誤與下面的代碼行:我不斷收到一個語法錯誤
# If the user asked for celsius then x will be a Celsius number converting to Fahrenheit number
if x = = c
你有什麼想法?
的= =
應該是你使用==
代替= =
(如果不明確),如==
if x == c:
確認 - >與==
取代=[SPACE]=
。
添加冒號以除去空間。
您需要提供更多信息。將確切的錯誤信息以及周圍的代碼複製到上面的'=='。順便說一句,你是否試圖檢查變量'x'是否包含字母'c'?如果是這樣,請使用'if x ==「c」:' –
請顯示完整的代碼。另外:http://docs.python.org/tutorial/controlflow.html – Drakosha