A uwuified sentence is sentence that has been transformed using a made-up Internet language in which...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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.')) 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.'))
Expert Answer:
Answer rating: 100% (QA)
Heres the implementation of the uwuify function according to the given rules Here are the test cases ... View the full answer
Related Book For
Chemistry The Central Science
ISBN: 978-0321696724
12th edition
Authors: Theodore Brown, Eugene LeMay, Bruce Bursten, Catherine Murphy, Patrick Woodward
Posted Date:
Students also viewed these programming questions
-
Explain how the following instruction will be converted to machine code MOV CX,[437AH].
-
Think of an organizational database in which some of the fields in the CUSTOMER table must have the following data types. Explain they mean and they are used. a. Customer ID (auto-numeric field) b....
-
Why is depreciation that has been recognized over the life of an asset shown in a contra account? Why not just reduce the asset account?
-
The following inventory information is available for Ricci Manufacturing Corporation for the year ended December 31, 2017: Beginning Ending Inventories: Raw materials Work in process Finished goods...
-
Do leaders always matter? Explain your answer in terms of substitutes and neutralizers.
-
One of the important criteria in foreign market entry is entry timing ( i . e . , entering a market early or late compared to your competition ) . What do you think the advantages and disadvantages...
-
Explain the reason why it is convenient to represent the bicubic spline in the form \[\operatorname{spline}(K, T)=\sum_{i=1}^{p} \sum_{j=1}^{q} c_{i j} M_{i}(K) N_{j}(T)\] where \(M_{i}(K), i=1,...
-
The image of a tree just covers the length of a plane mirror 4.00 cm tall when the mirror is held 35.0 cm from the eye. The tree is 28.0 m from the mirror. What is its height?
-
At the end of June, the job cost sheets at Ace Roofers show the following costs accumulated on three jobs. At June 3 0 Job 5 Job 6 Job 7 Direct materials $ 1 8 , 0 0 0 $ 3 4 , 5 0 0 $ 2 8 , 5 0 0...
-
Chris and Stefani Watanabe live with their two boys at 1400 Victoria Lane, Riverside, CA 92501. Chris is an accountant who has his own accounting practice. Stefani is an elementary school teacher....
-
Randomly create a set of 20 data points (N=20) such that for each point x=(x_1.x_2), the coordinates x_1.x_2 be integers. x_1.x_2 are to be limited to the [-30,+30] range and uncorrelated. Choose the...
-
The inverse demand function is P = 110 0.5q, and the inverse supply function is P = 320 +5q - 20r, where r is the rental cost of capital. a) Show how the equilibrium price and quantity vary with r?...
-
Suppose we consider a trial that can have l possible outcomes (say, rolling an l-sided die). Each of the outcomes occurs with some probability P, P2, ..., pe with p+p2+...+pe = 1. Suppose we have n...
-
MOH is excited about giving a vaccine for preventing Covid19 virus as the chance of a person being successfully prevented by it is very high. The probability of a person being successfully prevented...
-
Use the magnitudes of 120 earthquakes listed in the data below. Use technology to find range, standard deviation and variance. If anofher value 7.50 is added to those listed in fhe data set, do the...
-
The table below gives the number of suicides estimated in the U.S. for a recent year by age, race (black or white), and sex. We are interested in possible relationships between age, race, and sex. We...
-
Monica is a senior financial manager of Eclipse Ltd. She is conducting a capital budgeting analysis on a new product. She has already authorised an extensive market research on the marketability of...
-
Players A, B, and C toss a fair coin in order. The first to throw a head wins. What are their respective chances of winning?
-
During the discharge of an alkaline battery, 4.50 g of Zn is consumed at the anode of the battery. (a) What mass of MnO2 is reduced at the cathode during this discharge? (b) How many coulombs of...
-
Aspirin has the structural formula At body temperature (37C), K a for aspirin equals 3 10 -5 . If two aspirin tablets, each having a mass of 325 mg, are dissolved in a full stomach whose volume is 1...
-
Three cations, Ni2+,Cu2+, and Ag +, are separated using two different precipitating agents. Based on Figure 17.23, what two precipitating agents could be used? Using these agents, indicate which of...
-
Catherine Rampell is an economics writer for the Washington Post. In an article in 2023, she observes that the average U.S. tariff rate on mens underwear is 11.5 percent. The average rate on womens...
-
An opinion column in the Wall Street Journal argued that Americans enjoy comparative advantages in [service] sectors such as construction and engineering, but global trade in services is weighed down...
-
An article in the Wall Street Journal explained that despite rising national security tensions between the United States and China in 2023, trade between the two nations was rising. China is a...
Study smarter with the SolutionInn App