Write a function named value that accepts a dictionary D and a variable key as arguments. If key is not a key of the dictionary D, return None. Otherwise, return the value corresponding to this key.
You do not have to accept input from the user or print anything. You just have to write the definition of the function.
Example
value({'a': 1, 'b': 2, 'c': 3}, 'b') -> 2
value({'a': 1, 'b': 2, 'c': 3}, 'z') -> None
Implement this function:
def value(D, key):
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: D, key.
Input
{'a': 1, 'b': 2, 'c': 3}
'b'
Output
2