0
Q:

how to create dictionary in python

#title			: Dictionary Example
#author         : Joyiscold
#date           : 2020-02-01
#====================================================

thisdict = {
	"brand": "Ford",
 	"model": "Mustang",
 	"year": 1964
}

#Assigning a value
thisdict["year"] = 2018
10
thisdict = {
  "key1" : "value1"
  "key2" : "value2"
  "key3" : "value3"
  "key4" : "value4"
}
9
d = {'key': 'value'}
print(d)
# {'key': 'value'}
d['mynewkey'] = 'mynewvalue'
print(d)
# {'key': 'value', 'mynewkey': 'mynewvalue'}
1
# Creating a Dictionary  
# with Integer Keys 
Dict = {1: 'Geeks', 2: 'For', 3: 'Geeks'} 
print("\nDictionary with the use of Integer Keys: ") 
print(Dict) 
  
# Creating a Dictionary  
# with Mixed keys 
Dict = {'Name': 'Geeks', 1: [1, 2, 3, 4]} 
print("\nDictionary with the use of Mixed Keys: ") 
print(Dict) 
2

thisdict =	{

  "brand": "Ford",

  "model": "Mustang",

  "year": 1964

}

print(thisdict)

 
1
myDict = {'first item' : 'definition'}
#CREATING A BLANK DICTIONARY
myDict = {}
0

New to Communities?

Join the community