📜  如何在 python 代码示例中定义字典

📅  最后修改于: 2022-03-11 14:46:22.445000             🧑  作者: Mango

代码示例6
population = {"Shanghai":17.8, "Istanbul":13.3, "Karachi":13.0, "Mumbai":12.5}

#Consider the following when creating a dictionary
#    1. Must be inside {}
#    2. Have two parts in an item 
#            Key - e.g. Istanbul and Value - e.g. 13.3
#    3. There must be a colon ":" between the key and the value
#    4. Item must be seperated by commas ","
#    3. Any immutable type can be used as keys (not only integers like in lists)