make python dictionary code example
Example 1: python make a dictionary
#title : Dictionary Example
#author : Joyiscold
#date : 2020-02-01
#====================================================
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
#Assigning a value
thisdict["year"] = 2018
Example 2: dictionary in python
# Dictionaries in Python
ages = {"John": 43, "Bob": 24, "Ruth": 76} # Marked by { at beginning and a } at end
# ^^^ Has sets of keys and values, like the 'John' and 43 set. These two values must be seperated by a colon
# ^^^ Sets of values seperated by commas.
Example 3: how to create a dictionary in python
thisdict = {
"key1" : "value1"
"key2" : "value2"
"key3" : "value3"
"key4" : "value4"
}