PROJECT 6

Hacker Speaker: 1337 Sp34k3r

Are you ready to write a program turns messages into elite hacker speak (1337 sp34k)? You might’ve seen where someone replaces letters with numbers or other letters that resemble the original. A common example is using the number 3 to substitute for the letter E.

image

To do this, you read a heap about strings, lists, objects, and Python introspection. The code in this project is fairly straightforward, but the ideas that it relies on are quite deep. You’ll also see how crazy powerful Python is to do such amazing stuff with such simplicity. Everything in this project is something you’ll always use in Python!

Waiter, There’s An Object In My String

I thought about calling this section “Brain Explosion,” because it’s so chock-full of information. (My technical editor said she has never witnessed a brain explosion from knowing too much, so I think we’re safe.)

You’re familiar with strings; you ran into your first string literal back in Project 2. Do you remember that you named your Hello World string literal and by naming it you created a variable?

Power up IDLE and do it again right now:

>>> my_message = 'Hello World!'

Look, my editor’s opinions aside (I don’t think she has any medical qualifications), you might want to wrap a bandage around your head before proceeding to the next step. Just in case, you know? When you’ve done that, type this: ...

Get Python For Kids For Dummies now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.