Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

python code. I use \"Geany\" for coding.Answer it after code works on your compu

ID: 3774869 • Letter: P

Question

python code. I use "Geany" for coding.Answer it after code works on your computer.
textToEnglish.txt:(it is so long, I only take a screen shot of part of it) The De-slang-ifier In this assignment, you are writing a program that converts common texting abbreviations to English words to allow people like yours truly can understand. OMG! For the assignment, you are provided with a .txt file, called TextToEnglish.txt, that provides the abbreviations and their English translation. The file contains G-Rated translations only. The txt fie has comma separated values that list the key as the first item, a comma to separate the key from the value, and then the value. For this assignment, you need to submit one file called Assignment10 LastName,py where LastName is your last name. Please include comments in your code that explain what your code is doing. The comments should also include recitation TA, and the assignment number. Each function should be commented with the functions purpose and description of the parameters. Steps 1. write a function, called createDictionary that is given the name of the text file to be read. The function opens the given file, reads in data, and generates a dictionary. The dictionary key is the text abbreviation and the value is the English translation. For example, one entry in your dictionary will be, 18': 'late' because one of rows in the txt file contains 18' and late'. Your function should have one input: the name of the file to open, and one return value: the dictionary. Testyour function before moving on to the next step. You can do this by defining the function and then calling it in your py file: word Dictionary CreateDictionaryCfilename)

Explanation / Answer

Code:

def createDictionary(filename):
a = open(filename,"r")
b = a.readlines()
d = {}
for i in b:
c = i.split(",")
d[c[0]] = c[1][:-1]
return d
  
wordDictionary = createDictionary("input.txt")

def Deslang(slang,wordDictionary):
if slang in wordDictionary.keys():
slangd = slang.split(" ")
for i in range(len(slangd)):
if slangd[i] in wordDictionary.keys():
slangd[i]=wordDictionary[slangd[i]]
else:
slangd[i] = slangd[i]
return " ".join(slangd)
else:
return False

slang = input("Please enter a text abbreviation:")
result = Deslang(slang,wordDictionary)
if (result != False):
print(result)
else:
print("Not found")