nums_dict = {
"one" : 1,
"two" : 2,
"three" : 3,
"four" : 4,
"five" : 5,
}
value = nums_dict["two"]
print(value)
value = nums_dict["six"]
print(value)
# 2
# KeyError: 'six'
nums_dict = {
"one" : 1,
"two" : 2,
"three" : 3,
"four" : 4,
"five" : 5,
}
value = nums_dict["two"]
print(value)
value = nums_dict.get('six', 'key not found')
print(value)
value = nums_dict.get("six", 6)
print(value)
# 2
# key not found
# 6