Click here to play Python Challenge
If you cannot solve this one, please stop reading right now.
K->M, O->M, E->G
The difference between A->B is 2
There're two ways to approach it.
A.
def convert(str):
print chr(ord(str) + 2)
b = 'g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'
for i in b:
convert(i)
However as you can see, the output is messy because it also converted the white space and dots into other characters unintentionally.
i " h o p e " y o u " d i d n t " t r { n s l { t e " i t " | y " h { n d 0 " t h { t s " w h { t " c o m p u t e r s " { r e " f o r 0 " d o i n g " i t " i n " | y " h { n d " i s " i n e f f i c i e n t " { n d " t h { t ) s " w h y " t h i s " t e x t " i s " s o " l o n g 0 " u s i n g " s t r i n g 0 m { k e t r { n s * + " i s " r e c o m m e n d e d 0 " n o w " { p p l y " o n " t h e " u r l 0
B. Using this is much cleaner and neat. maketrans
from string import maketrans
int = "abcdefghijklmnopqrstuvwxyz"
out = "cdefghijklmnopqrstuvwxyzab"
trans_int_out = maketrans(int, out)
print b.translate(trans_int_out)
### output
"i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url."
Like the output asked, apply translate on "map".
b='map'
print b.translate(trans_int_out)
orc
View this page's source will see something commented out like this
<!-- find rare characters in the mess below: -->
strip off the <!-- -->
and save on disk, then go ahead and run the script here
You will get "equality", and let's copy and paste it on the browser.
You can also use this one by working wlists
v=open('file.txt','a+')
lst=v.read()
lista=['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']
trans=['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','b']
result=""
j=0
while j<len(lst):
if lst[j] in lista:
result=result+trans[lista.index(lst[j])]
else:
result=result+lst[j]
j=j+1
print(result)
v.close()