我不知道自己做错了什么。该计划正在显示:"syntax error"
和"if is not defined"
。
task = input (' select task 1, 2 or 3. Type 5 to exit\n')
If (task == 1 ) :
print "I am task 1! \n"
print "I can tell you the sum of two numbers. \n"
n = input ('input the first number \n')
m = input ('input the second number \n')
sum = n + m
print " their sum is : ", sum, ".\n"
答案 0 :(得分:2)
因为If(task == 1):
你必须写"如果"不是"如果"。大写字母"如果"必须小写
task = input (' select task 1, 2 or 3. Type 5 to exit\n')
if task == 1:
print "I am task 1! \n"
print "I can tell you the sum of two numbers. \n"
n = input ('input the first number \n')
m = input ('input the second number \n')
sum = n + m
print " their sum is : ", sum, ".\n"
这将有效。