Homework 2

I have worked on dictionaries in other way with the part 2, but could
not get the right solution. I will try for the solution.