我在最後一行第14行出現語法錯誤。我看不出爲什麼,因爲它似乎是一個簡單的打印語句。這個Python代碼中的語法錯誤在哪裏?
cel = "c"
far = "f"
cdegrees = 0
fdegrees = 0
temp_system = input ("Convert to Celsius or Fahrenheit?")
if temp_system == cel:
cdegrees = input ("How many degrees Fahrenheit to convert to Celsius?")
output = 5/9 * (fdegrees - 32)
print "That's " + output + " degrees Celsius!"
elif temp_system == far:
fdegrees = input ("How many degrees Celsius to convert to Fahrenheit?")
output = (32 - 5/9)/cdegrees
print "That's " + output + " degrees Fahrenheit!"
else print "I'm not following your banter old chap. Please try again."
請總是包含錯誤的完整回溯。 – 2012-04-12 15:28:22