python dict definition code example
Example 1: python make a dictionary
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["year"] = 2018
Example 2: what is a dictionary in programming
// This is a JS Object (dictionary eqiv.)
var obj = {
num:16,
str:'hello',
bool:true
};
Example 3: dictionary in python
d = {'key1':'value1','key2':'value2'}
print(d)
l=d.keys
print(l)
b=d.values
print(b)
Example 4: dictionary in python
my_dict = {'name': 'Jack', 'age': 26}
my_dict['age'] = 27
print(my_dict)
my_dict['address'] = 'Downtown'
print(my_dict)