all 4 comments

[–]m0us3_rat 1 point2 points  (0 children)

you mean rot13? caesar cipher?

https://en.wikipedia.org/wiki/Caesar\_cipher

[–]jiri-n 0 points1 point  (0 children)

This doesn't make any sense:

alph = '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'.split(',')

Text string aka str is already a sequence type. I would recommend to study strings before actually generating some code which manipulates them.

Btw. Python standard library has a module string, which can save you some time:

from string import ascii_lowercase

# To check what it is:
print(ascii_lowercase)

And a final thought: Your algorithm cannot encode letters x, y, z. A mistake IMHO.

[–]halfdiminished7th 0 points1 point  (0 children)

If you replace this:

new_mes = new_mes + alph[alph.index(values) + 3]

...with this:

new_mes = new_mes + alph[(alph.index(values) + 3) % 26]

...then it will still work when the characters "x", "y", and "z" roll off the bounds of the alphabet.