dictionary in pythpn code example
Example 1: dictionary in python
d = {'key1':'value1','key2':'value2'}
print(d) # to print full dictionary
l=d.keys
print(l) # to print keys
b=d.values
print(b)#to print values in dictionary
Example 2: dictionary in python
#a dictionary
dict = {
"key": "value",
"other_key": "value"
}
#get a value from the dictionary using the key
print(dict["key"])
#you can also get a value from the dictionary using a normal index:
print(dict[1])