# ACT 2-5 # Original string, with no punctuation. origString = 'The cat had a hat The cat sat on the hat' # Word frequency dictionary. freqDict = {'the':3,'cat':2,'had':1,'a':1,'hat':2,'sat':1,'on':1} # Phone number dictionary. phoneDict = {'PolyU': '2766-5111', 'COMP':'2766-7200', 'CY':'2878-3300', 'LegCo':'3919-3333'} # Takes a dictionary as input and prints the key-value pairs. Returns nothing. def printDict(dictionary): keyList = dictionary.keys() for key in keyList: print('key:',key,'value:',dictionary[key]) return # Takes a list as input and prints the values. Returns nothing. def printList(myList): myRange = range(0,len(myList)) for i in myRange: print('index:',i,'value:',myList[i]) return # Takes a string and returns a dictionary of word frequencies # e.g. if we give it origString, it should return something that's like freqDict def wordFreq(myString): word_freqs = {} # Initialize an empty list. myList = myString.lower().split() # lower() changes everything to lowercase (small letters) for word in myList: print('do something here to fill the dictionary.') return word_freqs