simple dictionary program in python code example
Example 1: what is a dictionary in programming
// This is a JS Object (dictionary eqiv.)
var obj = {
num:16,
str:'hello',
bool:true
};
Example 2: how to write a dict in pytohn
# get vs [] for retrieving elements
my_dict = {'name': 'Jack', 'age': 26}
# Output: Jack
print(my_dict['name'])
# Output: 26
print(my_dict.get('age'))