remove_key(d, key) that removes key from dict d in place and returns its removed value. If key is not present, return None and leave d unchanged (do not raise an error).d = {'x': 1, 'y': 2}; remove_key(d, 'x')1
d becomes {'y': 2}, and the removed value 1 is returned.
remove_key({'x': 1}, 'z')None
z was never a key, nothing changes.
`d.pop(key, None)` removes and returns the value, or the default if missing.