"""Caesar cipher solver""" # variables go here alphabet = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" letter_list = [] # functions here def decode(increment_repeat=0): """Decodes strings.""" for x in range(0, letter_amount): if (input_string[0 + increment_repeat]) == " ": increment_repeat += 1 letter_list.append(" ") elif (input_string[0 + increment_repeat]).isnumeric(): increment_repeat += 1 letter_list.append(input_string[-1 + increment_repeat]) else: letter = ord(input_string[0 + increment_repeat]) increment_repeat += 1 letter_list.append(alphabet[(letter - 97) - key]) input_string = input("string? ") letter_amount = len(input_string) while True: key = int(input("key? ")) if 27 > key > -27: break else: print("key must be below 27 and above -27") decode() printable_string = ''.join(letter_list) print(printable_string)