无效的语法---python [英] Invalid syntax---python
本文介绍了无效的语法---python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不明白为什么在我的所有 If 语句中都说 Options 这个词的语法无效
I can't figure out why it is saying invalid syntax for the word Options in all of my If statements
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 is case-sensitive. If
needs to be if
. Your code also needs to be indented properly.
这篇关于无效的语法---python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文