Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Turn Your User Into a L33t H4ck3r (Exercise)

00:00 You’ve made it all the way to the challenge of this course, and the challenge is to turn your user into a L33t H4ck3r, which just means that you should write a program that you’ll call translate.py, that asks the user for some input with the following prompt, just saying "Enter some text: ", and then you should use .replace(), so the string method .replace(), to convert the text entered by the user into leetspeak.

00:23 And that means you should make the following changes to lowercase letters only. If you have an "a", it should turn into a "4", if you have a "b" into an "8", "e" into a "3", "l" into a "1", "o" into a "0", "s" into a "5", and "t" into a "7", which means that an example run of the program should look like below.

00:45 You see the prompt here that says, "Enter some text: ", and then here the user entered, I like to eat eggs and spam. Then your program converted this into, well, the same, I 1ik3 70 347 3gg5 4nd 5p4m, but in leetspeak. You can see that some of the lowercase characters are replaced with numbers.

01:06 And maybe you already noticed that there’s not that much more to do in this challenge than to the exercises that you did before. It’s not going to be very long, but I think it’s still justified to think of this as a challenge because the output that you get here is actually some sort of a product.

01:22 I’m sure there’s a couple of leetspeak translators out there on the Internet, and you’re now going to write the code that’s necessary to run these things.

01:30 So that’s pretty cool, right? This is something you can show off, and this is a little program that actually does something that’s, I mean, I don’t know how useful it is, but it’s kind of fun, and it’s something that you can show to your friends and to your family.

01:42 All right? So get ready. Remember all the things you’ve practiced throughout this course, and write your translate.py leetspeak translator, and then hop over to the next lesson to see me solve it.

Become a Member to join the conversation.