# Write a function to return the mean difference in the length of keys and values of dictionary comprising of strings only.

## Topic: Write a function to return the mean difference in the length of keys and values of dictionary comprising of strings only.

Solution

def mean_key_val_diff(input_dict): sum_diff = 0 for key, val in input_dict.items(): sum_diff += abs(len(val) - len(key)) return sum_diff/len(input_dict)

List all Python Programs