Python Problem Please help me with this problem Below is the

Python Problem:

Please help me with this problem:

Below is the question and smaple of the file: textToEnglish.csv

Thank You very much!

$$

money

$$

money

/. Slashdot
*4u Kiss for you
*67 unknown
*eg* evil grin
0day software illegally obtained before it was released
0noe Oh No
0vr over
10q thank you
10tacle Tentacle
10x thanks
12b wannabe
1337 elite
133t elite
143 I love you
187 murder
1ab wannabe
1daful wonderful
1dering wondering
1nce once
1sec one second
2 too
2b to be
2b4u too bad for you
2bad4u2 too bad for you too
2bh to be honest
2da to the
2dae today
2day today
2ditd today is the day
The De-slang-ifier In this assignment, you are writing a program that converts common texting abbreviations to English words that people like yours truly can understand. OMG! For the assignment, you are provided with a .csv file, called TextToEnglish.csv, that provides the abbreviations and their English translation. The file contains G-Rated translations only All of your code for this assignment should be in one .py file. Please label the file LastName Assignment8.py. Please also include comments in your code to describe what your code is doing. Comments should also include your name, recitation TA and the assignment and problem number Steps 1. Write a function, called CreateDictionary that opens the TextToEnglish.csv file and generates a dictionary, where the 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 the rows in the csv file contains \"18\' and \'late\' Your function should have one input: the name of the file to open, and one return value: the dictionary. Test your function before moving on to the next step. You can do this by defining the function and then calling it: word Dictionary Create DictionaryCfilename) in your .py file 2. Write a function main that does the following: a. Call the CreateDictionary function b. Prompt the user for a text abbreviation c. Next, check if the user\'s input is in the dictionary. If it is, print the English words associated with the abbreviation. If any abbreviation is not found, print \"NF\" for \"Not Found\" d. Write your main function to accept an arbitrary number of text abbreviations from the user, separated by a space, and print a message that displays the meaning of all abbreviations. For example, if the user enters, \"y r u 18\", your program should print \"why are you late e. Your main also needs a loop that allows the user to continue inputting abbreviations and printing the English meaning of those abbreviations until the user says \"quit

Solution

import csv

\"\"\"

@filename:string path of csv file

\"\"\"
def CreateDictonary(filename):
word_dict={}
with open(filename, newline=\'\') as csvfile:
spamreader = csv.reader(csvfile)
for row in spamreader:
word_dict[row[0]] = row[1]
return word_dict
  
if __name__ == \'__main__\':
wordDictonary = CreateDictonary(\'input.csv\')
flag=\"\"
while flag!=\"quit\":
abvr = input().split(\" \")
flag = abvr[0]
  
for x in abvr:
if x in wordDictonary:
print(wordDictonary[x])
else:
print(\"NF\")

Python Problem: Please help me with this problem: Below is the question and smaple of the file: textToEnglish.csv Thank You very much! $$ money $$ money /. Slas
Python Problem: Please help me with this problem: Below is the question and smaple of the file: textToEnglish.csv Thank You very much! $$ money $$ money /. Slas

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site