1.a)Write a function calledtranslate_text() that takes a string as…
Question Answered step-by-step 1.a)Write a function calledtranslate_text() that takes a string as… 1.a)Write a function called translate_text() that takes a string as a parameter (SMS abbreviation), translates the abbreviation into its English phrase (or words) and returns the translated text (as a string). Your function should translate the following abbreviations into their English phrase equivalent:YOLO = You only live onceGTG = Got to goROFL = Rolling on the floor laughingIMO = In my opinionIf an abbreviation is passed to the function that is not contained in the above list, the function should return the string “Undefined”.For example:Calling the function translate_text like so:translation = translate_text(“IMO”)will assign to the string “In my opinion” to variable translation. Calling the function translate_text like so:translation = translate_text(“SMH”)will assign to the string “Undefined” to variable translation. 1.b)Using the function translate_text() written above (in part a), and the following list definition: sms_text = [‘YOLO’, ‘IMO’, ‘GTG’, ‘SMH’]Show how you would call function translate_text() so that the above list is displayed to the screen as follows: YOLO = You only live onceIMO = In my opinionGTG = Got to goSMH = Undefined You MUST call the function translate_text() from within a loop. If you didn’t complete part a), you may assume that you did in order to answer this question. Computer Science Engineering & Technology Python Programming COMP 1039 Share QuestionEmailCopy link Comments (0)


