I've made a hasher. It works and it's really simple. I made one for fun and I thought that the code is way too long. It's over 1000 lines long and it's so simple. I just want to shorten it down. Here's how I did the code:
wordorg = raw_input("Enter a word here: ")
## Checking if what you typed is correct
if len(wordorg) <= 10 and len(wordorg) > 1 and wordorg.isalpha():
## Comparison (JESUS THIS IS A LONG PIECE OF CODE)
print "Your original word was: " + wordorg
word = wordorg.lower()
if len(word) >= 1:
if word[0] == "a":
one = a
if word[0] == "b":
one = b
if word[0] == "c":
Bla bla bla, you get the idea, it goes like that. When it reaches Z
if word[0] == "z":
one = z
if len(word) >= 2:
if word[1] == "a":
And it goes on. My question is, how can I shorten my code?
EDIT: The integers a, b, c are defined like this:
a = 2
b = 3
c = 5
and so on.