Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-列表中冒号的语法错误_Python_List_Syntax - Fatal编程技术网

Python-列表中冒号的语法错误

Python-列表中冒号的语法错误,python,list,syntax,Python,List,Syntax,我一直在尝试创建一个简单的字典来定义用户输入的单词。在定义了字典及其单词之后,我试图打印输入单词的定义。由于某种原因,当我试图运行这个程序时,列表中的冒号出现语法错误。我不知道如何解决这个问题,我知道有更简单的方法,但我正在尝试使用列表。 以下是迄今为止的代码: 词典 您忘记了在dict中每个条目的末尾都有一个逗号。dict使用大括号“{…}” 谢谢!:我知道我错过了一些简单的事情 dic1 = [ 'bug':'A broken piece of code that causes a

我一直在尝试创建一个简单的字典来定义用户输入的单词。在定义了字典及其单词之后,我试图打印输入单词的定义。由于某种原因,当我试图运行这个程序时,列表中的冒号出现语法错误。我不知道如何解决这个问题,我知道有更简单的方法,但我正在尝试使用列表。 以下是迄今为止的代码:

词典
您忘记了在dict中每个条目的末尾都有一个逗号。dict使用大括号“
{…}


谢谢!:我知道我错过了一些简单的事情
dic1 = [
    'bug':'A broken piece of code that causes a program to stop functioning'
    'string':'A piece of text'
    'integer':'A whole number'
    'float':'A decimal number'
    'function':'A block of organized and clean code that performs a task/action'
    'syntax':'A set of rules that says how a program will be coded'      
    ]

q = input("What coding related word do you want defined?")
if q in dic1:
    print(dic1[q])
dic1 = {
    'bug':'A broken piece of code that causes a program to stop functioning',
    'string':'A piece of text',
    'integer':'A whole number',
    'float':'A decimal number',
    'function':'A block of organized and clean code that performs a task/action',
    'syntax':'A set of rules that says how a program will be coded',      
    }