Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python 3 and some explanation plz Write a function that translates an English sentence to leetspeak. Hints: You will want to turn your sentence

image text in transcribed

use python 3 and some explanation plz

Write a function that translates an English sentence to leetspeak. Hints: You will want to turn your sentence into a list of words, replace those, and then turn it back into a sentence before replacing letters. To turn a list of words into a sentence, you can use the syntax: new_sentence = "".join(old_list) This will join all the values in "old list" into a string, separated by spaces. If you want to determine if a word is in your dictionary, use "if word in dictionary.keys" You may assume that the sentences are, much like YouTube comments, devoid of any punctuation or capitalization. Use the following general algorithm: Replace the following words: . elite -> leet the -> teh hacker -> haxor hack ->hax own >> pwn owned -> pwned dude -> dood rocks -> roxxorz awesome -> awezome internet -> teh tubes ever -> evarr 1md3 -> most awesome course ever If any word ends with an 's', replace it with a 'z' Replace the following letters: . a -> "@" . e-> "3" . t->"7" . |-> "1" . 0-> "0" S -> "S" Replace the words before replacing the letters, so that the replaced words will have the replaced letters def leet(s): # 'Pri7h33 7@k3 3@rn3$7 3ffr7 70 p1@c3 $uch wordz in $uffici3n7 3nvironz 70 3x3mplify 73h m0$7 @fflu3n7 of in73113c7@11 return stuff print("How'd I do?!") print("#1 - ", leet("I'm very well acquainted too with matters mathematical") == "I'm v3ry w311 @cqu@in73d 700 wi7h m@773 print("#2 - ", leet("I understand equations both the simple and quadratical") == "I und3r $7@nd 3 qu@7i0nz bo7h 73h $imp13 print("#3 - ", leet("About binomial theorem I'm teeming with a lot of news") == "Abou7 binomi@1 7h30r3m I'm 733ming wi7h print("#4 - ", leet("With many cheerful facts about the square of the hypotenuse!") == "Wizh m@ny ch33rful f@c7z @bu7 73

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions

Question

e. What are notable achievements of the group?

Answered: 1 week ago