I have been coding with Python for a few months, and I have already coded a successful cipher, but I am making a random cipher and it won't work. I have attached the code.
txt=input("Input message.\n")
numbers=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
ra.shuffle(numbers)
a1=numbers[1]
b1=numbers[2]
c1=numbers[3]
d1=numbers[4]
e1=numbers[5]
f1=numbers[6]
g1=numbers[7]
h1=numbers[8]
i1=numbers[9]
j1=numbers[10]
k1=numbers[11]
l1=numbers[12]
m1=numbers[13]
n1=numbers[14]
o1=numbers[15]
p1=numbers[16]
q1=numbers[17]
r1=numbers[18]
s1=numbers[19]
t1=numbers[20]
u1=numbers[21]
v1=numbers[22]
w1=numbers[23]
x1=numbers[24]
y1=numbers[25]
z1=numbers[26]
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
a=alphabet[a1]
b=alphabet[b1]
c=alphabet[c1]
d=alphabet[d1]
e=alphabet[e1]
f=alphabet[f1]
g=alphabet[g1]
h=alphabet[h1]
i=alphabet[i1]
j=alphabet[j1]
k=alphabet[k1]
l=alphabet[l1]
m=alphabet[m1]
n=alphabet[n1]
o=alphabet[o1]
p=alphabet[p1]
q=alphabet[q1]
r=alphabet[r1]
s=alphabet[s1]
t=alphabet[t1]
u=alphabet[u1]
v=alphabet[v1]
w=alphabet[w1]
x=alphabet[x1]
y=alphabet[y1]
z=alphabet[z1]
txta=txt.replace("a","á")
txtb=txta.replace("b","+")
txtc=txtb.replace("c","ç")
txtd=txtc.replace("d","ð")
txte=txtd.replace("e","é")
txtf=txte.replace("f","đ")
txtg=txtf.replace("g","ŋ")
txth=txtg.replace("h","ħ")
txti=txth.replace("i","í")
txtj=txti.replace("j","j̉")
txtk=txtj.replace("k","ĸ")
txtl=txtk.replace("l","ł")
txtm=txtl.replace("m","µ")
txtn=txtm.replace("n","n̉")
txto=txtn.replace("o","ó")
txtp=txto.replace("p","þ")
txtq=txtp.replace("q","@")
txtr=txtq.replace("r","¶")
txts=txtr.replace("s","ß")
txtt=txts.replace("t","ŧ")
txtu=txtt.replace("u","ú")
txtv=txtu.replace("v","̉")
txtw=txtv.replace("w","ẃ")
txtx=txtw.replace("x","»")
txty=txtx.replace("y","ý")
txtz=txty.replace("z","«")
texta=txtz.replace("á",a)
textb=texta.replace("+",b)
textc=textb.replace("ç",c)
textd=textc.replace("ð",d)
texte=textd.replace("é",e)
textf=texte.replace("đ",f)
textg=textf.replace("ŋ",g)
texth=textg.replace("ħ",h)
texti=texth.replace("í",i)
textj=texti.replace("j̉",j)
textk=textj.replace("ĸ",k)
textl=textk.replace("ł",l)
textm=textl.replace("µ",m)
textn=textm.replace("n̉",n)
texto=textn.replace("ó",o)
textp=texto.replace("þ",p)
textq=textp.replace("@",q)
textr=textq.replace("¶",r)
texts=textr.replace("ß",s)
textt=texts.replace("ŧ",t)
textu=textt.replace("ú",u)
textv=textu.replace("̉",v)
textw=textv.replace("ẃ",w)
textx=textw.replace("»",x)
texty=textx.replace("ý",y)
text=texty.replace("«",z)
print(text)
It just comes up with IndexError: list index out of range. Anybody got any idea why? It affects the letter z, and when I remove it, it affects the letter j. And if you're wondering why there are special characters, it's so that if a goes to z and z goes to a then a will go to z which will then go back to a. I call it double substitution.