为什么冒号以“无效语法”出现?

时间:2019-05-29 07:07:41

标签: python

我正在使用if命令,它说:invalid syntax,但我不知道为什么。顺便说一下,我还没有完成程序。

我尝试添加空格。好,就是这样。

import random
name = input("What's your name? ")
c = int(input("Hi",name,", would you like to get someone around you to choose your word to guess(1) or choose randomly from a preselected list(2)? ")
if c == 1 : #this is the colon that is wrong
        word = input('What word should',name,'guess? ')
elif c == 2 :
        word = random.choice(['burger', 'pizza', 'sushi'])
else:
        print('That is not a valid answer. Please restart the program and choose 1 or 2.')

在此阶段应该发生的事情是,应该继续执行该程序并检查是否为c == 2并打印输入。

1 个答案:

答案 0 :(得分:1)

您错过了上一行的右括号

 <configSections>
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" requirePermission="false"/>
</configSections>
<ajaxControlToolkit additionalUploadFileExtensions="msg" /> ```