insert_pair#
Implement a function insert_pair
that takes in a dictionary
, key
, and value
and adds the new key
and value
pair to dictionary
. Your function should return the resulting dictionary.
For example, if dictionary = {'instructors': 2, 'TAs': 10, 'tutors': 35, 'students': 600}
, key = 'head tutors'
, and value = 2
. Your function should return the following dictionary.
{'instructors': 2, 'TAs': 10, 'tutors': 35, 'students': 600, 'head tutors': 2}
Sample Input 1:
{‘instructors’: 2, ‘TAs’: 10, ‘tutors’: 35, ‘students’: 600} head tutors 2
Sample Output 1:
{'instructors': 2, 'TAs': 10, 'tutors': 35, 'students': 600, 'head tutors': 2}
Sample Input 2:
{'CSE': 4, 'MATH': 10}
BIO
4
Sample Output 2:
{'CSE': 4, 'MATH': 10, 'BIO': 4}
Sample Input 3:
{}
10
2
Sample Output 3:
{10: 2}