Assignment 6 lab 7 - Vinniethatguy/UMKCCS101Labs GitHub Wiki
The Caesar Cipher is an encryption/decryption method that shifts the alphabet. For instance, if you have a cipher that shifts by 1, A would become B, B would become C, Z would wrap and become A. To decrypt that cipher you simply shift by -1. We need you to write a utility that EncodesandDecodes a Cipher. The Rules.•The main program loop should ask the user if they want to.o1. Encode a stringo2. Decode a stringoQ. Quit•If the user chooses anything other than 1, 2,or Q, they get an error and it tries again.•If they want to encrypt a word or sentence, ask for the phrase and then ask for the # to shiftby, once you encrypt the string, output the result to the user.•If they want to decrypt a word or sentence, ask for the string and the # of to shift by. Then display the decrypted string to the user.•Go back to the main menu until they select quit.
The program starts off with our two functions. The most important part of the program is the quation, chr(ord('A') + ((ord(letter) - 65 + key) % 26)). Which will turn the character into its unicode value and back to a character and add the key to the word. We're assuming the key is 3. There's 26 letters in the alphabet so we're going to use the mod function to get our number back, and the letter associated with the number.