Question: Python Problem Write comments for understanding Let's say that a counting dictionary is a dictionary in which all values (not keys) are positive integers. (In
Python Problem

Write comments for understanding
Let's say that a counting dictionary is a dictionary in which all values (not keys) are positive integers. (In other words, it's the kind of dictionary you get when you use a dictionary to count repetitions of keys.) Given two count dictionaries, A and B, the difference between A and B is another count dictionary that contains the key-value pairs (k, n) where n = A[k] -B[k] for exactly those keys k such that n > or k appears only in A Write a function count_dict_difference(A, B) that takes as arguments two count dictionaries and returns a new dictionary that is the difference between them. You can assume that both arguments are dictionaries, and the values stored in them are integers. You should make no assumption about the types of keys that can appear in the dictionaries. Your function must not modify either of the argument dictionaries. Your function should value of type dict. Example: For example if A- (' s : 4, 'm' : 1, ? p' : 2, 'i ' : 4} (that's the letter counts for the word 'mississippi') and B = {'e': 1, 's': 3, 'm": 1, p": 1, i': 2, t": 1} (that's the letter counts for the word pessimist'), the difference of A and B is the dictionary's'1, 'p'1, ' : 2} (note how 'm' is not in the difference because A[ 'm' ] -B [ 'm' ] = 0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
