Question: write in python pls. update_dictionary funciton: def update_dictionary(filename,d): try: with open(filename,'r')as f: print(filename + ' loaded successfully.') for line in f: words=line.strip().split(',') d[words[0]]=words[1] except: print(filename+'
write in python pls.
update_dictionary funciton:
def update_dictionary(filename,d): try: with open(filename,'r')as f: print(filename + ' loaded successfully.') for line in f: words=line.strip().split(',') d[words[0]]=words[1] except: print(filename+' does not exist.') print('The dictionary has ' + str(len(d.items()))+' entries.') return d
Write a function deslang that takes two parameters, a string and a dictionary, and returns the deslanged string. Each word in the string will be replaced if it has an entry in the dictionary. Any word not in the dictionary should be copied to the results. deslanged- deslang slang, wordDictionary) For example, if the slang string is: "David, y r u l8" your function should return: "David, why are you late" Copy your solution to the previous question "update dictionary" here. Answer: (penalty regime 0 %) Check
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
