#!/usr/bin/python3 # -*- coding: utf-8 -*- key: int = int(input("\nEnter your Caesar key in numeric form (1-25): ")) mode: int = int(input("\nEnter 1 for encryption, and 0 for decryption: ")) character_str: str = input( "\nEnter the Caesar encoding of the first character of your message: " ) while not character_str.isnumeric(): character_str = input( "\nEnter the Caesar encoded INTEGER corresponding to yoru next character: " ) character = int(character_str) while True: print("\tYour letter translated to:") # Does using a loop help here? If yes, why? If no, why? if mode == 1: # 26 is the symbol set size (# letters in alphabet) print("\t", (character + key) % 26) else: print("\t", (character - key) % 26) character_str = input("\nEnter the Caesar encoded next character, or -1 for done: ") if character_str == "-1": break while not character_str.isnumeric(): character_str = input( "\nEnter the Caesar encoded INTEGER corresponding to your next character: " ) character = int(character_str) print("\nend of Caesar encoded message\n")