I am currently making a cipher program in python but I can't seem to solve this one problem:
word = ['a', 'b', 'c']
-----enciphering process-------
message = ['d', 'e', 'f']
print message[x],
What I want to happen:
'def'
What actually happens:
'd e f'
I know why the spaces are there, but I can't seem to get rid of them, I've tried using strip, replace, re.sub, message(map whatever I don't remember), and "".join. Those all work with a pre-determined list but not when I don't know what the list is going to be.
Help please.
*EDIT
What I meant was something like this:
Word = raw_input("Enter a word ")
Message = list(word)
w = raw_input("Enter a number ")
w = int(w)
n = len(message)
Letters = ['a', 'b', 'c', 'd' and so on until z]
For y in range(0,n):
For index in range(0,26):
X = index + w
If x > 25:
x = x - 26
If message[y] == letters[index]:
print letters[x],
Not sure how to get rid of the spaces because I don't know what the message is gonna be