user66449
0
Q:

python make a dictionary

# Empty Dictionary
dictionary = {}
# Populated Dictionary
dictionary = {'a': 1, 'b': 2, 'c': 3}
6
#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

New to Communities?

Join the community