Question: A uwuified sentence is sentence that has been transformed using a made-up Internet language in which some of the letters in the words are

A uwuified sentence is sentence that has been transformed using a made-up

A uwuified sentence is sentence that has been transformed using a made-up Internet language in which some of the letters in the words are replaced by something else. The exact scheme is described below: Any uppercase/lowercase R or L is replaced by w/w, respectively. If we encounter an 0/0 in a word, check if the previous letter (if it exists) is an M/m or N/n. If the previous letter is one of these, insert the lowercase letter y in between them, regardless of the capitalization of the other letters. All other characters are left unchanged. Some examples: Professor will be converted to Pwofessow (There are two r's that are replaced by w's. Since the two o's aren't proceeded by an M/n or N/n, no y will be inserted.) LLunoacyo will be converted to WWunyoacyo (The two L's will be replaced with two ws according to the first rule. Then the first o will have a y inserted in front of it between the n and the o according to the second rule. The last o won't have a y inserted in between because it is not preceded by an M/m or N/n.) Write the function uwuify which takes in a sentence stored in the argument named sentence and then uwuifies the string according to the scheme described above. Examples: Function Call Return Value uwuify('Hello, Wolfie the Seawolf!") Hemo, Wowfle the Seauowf! uwuify('My mom gave me sardines for lunch. (') My myon gave me sowdines fow unch. ( unuify('LOLcats love fish!") WOlicats wove fish! uwuify('Nom nom, delicious!") Nyon nyon, devicious! uwuify('I can has cheezburger? Catllom says no.") I can has cheezbungen? Catflyon says nyo. 1 def uwuify(sentence): s 2 3 4 return 'error # Delete this line and start coding here www # Remember: end all of your functions with a return statement, not a print statement! 5 6 # Test cases 7 print (uwuify('Hello, Wolfie the Seawolf!')) 8 print (uwuify ("My mom gave me sardines for lunch. :(')) 9 print (uwuify("LOLcats love fish!")) 10 print (uwuify('Nom nom, delicious!')) 11 print (uwuify('I can has cheezburger? CatMom says no.'))

Step by Step Solution

3.47 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the implementation of the uwuify function according to the given rules Here are the test cases ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!