import string def shift(s): l = [] for char in s: l.append(char) for i in range(len(l)): l[i] = fromto[l[i]] output = '' for char in l: output = output + char print output fromto = {' ': ' ', "'": "'", ')': ')', '(': '(', '.': '.', '/': '/', ',': ',', 'a': 'c', 'c': 'e', 'b': 'd', 'e': 'g', 'd': 'f', 'g': 'i', 'f': 'h', 'i': 'k', 'h': 'j', 'k': 'm', 'j': 'l', 'm': 'o', 'l': 'n', 'o': 'q', 'n': 'p', 'q': 's', 'p': 'r', 's': 'u', 'r': 't', 'u': 'w', 't': 'v', 'w': 'y', 'v': 'x', 'y': 'a', 'x': 'z', 'z': 'b'} s = "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." enter = raw_input("Enter word to shift, or quit: ") while enter != 'quit': shift(enter) enter = raw_input("Enter word to shift, or quit: ") ##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. ###alternative ## ##table = string.maketrans('abcdefghijklmnopqrstuvwxyz','cdefghijklmnopqrstuvwxyzab') ##print s.translate(table)