Python - Syntax error on colon in list

前端 未结 1 1629
我寻月下人不归
我寻月下人不归 2021-01-21 04:35

I\'ve been trying to create a simple dictionary to define a word that the user inputs. After defining the dictionary and it\'s words, I\'m trying to print the definition of the

相关标签:
1条回答
  • 2021-01-21 04:54

    You forgot a comma at the end of each entry in the dict. Dicts use curly braces "{...}"

    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',      
        }
    
    0 讨论(0)
提交回复
热议问题