Can you fix this code, I keep getting a synatax error. Its a simple python code that suppose to encrypt letters and create a secret code. I would also for the code to accept any word. from random import shuffle #for shuffle from string import ascii_lowercase #for lowercase a = [0]*26 #original index for i in range(26): a[i] = i shuffle(a) #shuffled index arrayOfLetters = ascii_lowercase; #lowercase letters plain = raw_input('Enter String to encrypt: ') encrypt = "" #encrypted string for i in range(len(plain)): index = ord(plain[i])-97 print plain[i],index,a[index],arrayOfLetters[a[index]] encrypt = encrypt + arrayOfLetters[a[index]] print encrypt
Can you fix this code, I keep getting a synatax error. Its a simple python code that suppose to encrypt letters and create a secret code. I would also for the code to accept any word.
from random import shuffle #for shuffle
from string import ascii_lowercase #for lowercase
a = [0]*26 #original index
for i in range(26):
a[i] = i
shuffle(a) #shuffled index
arrayOfLetters = ascii_lowercase; #lowercase letters
plain = raw_input('Enter String to encrypt: ')
encrypt = "" #encrypted string
for i in range(len(plain)):
index = ord(plain[i])-97
print plain[i],index,a[index],arrayOfLetters[a[index]]
encrypt = encrypt + arrayOfLetters[a[index]]
print encrypt

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images









