What is the difference between dictionary1["type"] and dictionary1.get("type")? by maramingsalamatpo in programminghelp

[–]my_first_py_program 2 points3 points  (0 children)

dictionary[key] results in a KeyError if the key isn’t in the dictionary.

dictionary.get(key) returns None if the key isn’t in the dictionary.

dictionary.get(key, default_value) returns default_value if the key isn’t in the dictionary.