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

The language used in here is Python. I really need some help for this. Thank you

ID: 3797866 • Letter: T

Question

The language used in here is Python.

I really need some help for this. Thank you!

You are to write a program that converts sentences constructed using text message (SMS) s(into sentences using the proper King's English. Your program should be aware of the following SMS s(equivalences: Punctuation marks will mess up your program if you are not careful. You will need to check for punctuation, save the punctuation, perform the translation, and then put the punctuation mark hack. You can check if the last character of a word is a punctuation mark using: if word [- 1] in" .?!, ;:": print "The last character is a punctuation mark!!" The last character can be trimmed using the string.rstrip() method. Your program should take input from the user (written in SMS slang) and convert it into the King's English. Your program should make use of a dictionary. Show your completed program to the TA and demonstrate that it works. Example Output: Enter message to translate: y r u 18? Message in the King's English: why are you late?

Explanation / Answer

import re
n = ["gr8","btw","imho","jk","l8r","np","r","u","y","ttyl","l8","atm","lmk","np","tia","brb"]
m = ["great","by the way","in my humble opinion","just kidding","later","no problem","are","you","why","talk to you","late","at the moment","let me know","no problem","thanks in advance","be right back"]
a = input("Enter message to translate:")
a = re.findall(r"[w']+|[.,!?;:]",a)
print("Message in the King's English:",end=' ')
for s in a:
if s in n:
for i in range(len(n)):
   if (n[i]==s):
    print(' ',m[i],end='')
   break
else :
print(s,end='')
print (" ")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote