无效的语法---蟒蛇
我想不通为什么它是说这个词的选项无效语法我所有的if语句无效的语法---蟒蛇
Options = raw_input("Would you like to Square, Cube, Multiply, or Divide? ")
If Options == "Square" or Options == "square":
Square = int(raw_input("What number would you like to Square? "))
Answer1 = Square ** 2
print "The answer is :%d" %Answer1
if Options == "Cube":
Cube = int(raw_input("What number would you like to Cube "))
Answer2 = Cube ** 3
print "The answer is :%d" %Answer2
if Options == "Multiply":
Multiply1 = int(raw_input("What is the first number to multiply? "))
Multiply2 = int(raw_input("What is the second number to multiply? "))
Answer3 = Multiply1 * Multiply2
print "The answer is :d%" %Answer3"
Python是区分大小写的。 If
需要是if
。你的代码也需要正确缩进。
Python也是空白区域敏感的,所以按下每个if下的选项卡一次。 – VoronoiPotato 2012-08-02 18:02:12
非常感谢。我已经在我的版本中正确缩进了,但是它说我必须以某种方式发布我的问题,所以我只是改变了它。 – user1539175 2012-08-02 18:30:28
要在问题中发布代码,请从您的编辑器复制并粘贴该代码,突出显示它,然后点击代码格式化按钮。不要删除格式,特别是对于Python代码。 – geoffspear 2012-08-02 18:33:09
阅读基本的Python教程在这里会很有帮助 – 2012-08-02 18:05:08
中断器指向错误所在的位置。利用此功能。 – 2012-08-02 18:07:23