elif在Python中给我一个'无效语法'

时间:2017-05-26 08:54:51

标签: python

我正在研究一种测量转换器。我通过整个代码与ifelif合作,但现在我从Invalid Syntax获得了elif

elif original_measure == "inches":
   if new_measure == "meters":
      print(number, "inches =", number * 0.0254, "meters"
   elif new_measure == "kilometers":
      print(number, "inches =", number * 2.54e-5, "kilometers")
   elif new_measure == "centimeters":
      print(number, "inches =", number * 2.54, "centimeters")
   elif new_measure == "miles":
      print(number, "inches =", number * 1.5783e-5, "miles")
   elif new_measure == "feet":
      print(number, "inches =", number * 0.0833333, "feet")
   elif new_measure == "yards":
      print(number, "inches =", number * 0.0277778, "yards")
   else:
      print("'", new_measure, "'", "is an unknown new measure")

第一个elifelif new_measure == "kilometers":获取无效语法。

1 个答案:

答案 0 :(得分:1)

您错过了第一个)的结束print