#-*- coding:utf-8 -*- ##D.has_key(k): A predicate that returns True if D has a key k.##D.items(): Returns the contents of dictionary D as a list of two-element tuples(k,v),##D.iteritems():Returns an iterator that generates the values from dictionary…