Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Notes and Hints: You should start with this program, as with all programs, by breaking the program down into parts. Here is some of that

image text in transcribedimage text in transcribed
Notes and Hints: You should start with this program, as with all programs, by breaking the program down into parts. Here is some of that breakdown to help you 1. Your program should continuously prompt for a command. Can you write a loop that prompts for one of the three commands 'd', 'e' or 'q' and reports an error if it is not one of those commands? A rotation of an alphabet. Start with a string that consists of the letters a-z in a single string. How can you create a new string of the same length that has a particular rotation? Think of the string slicing operators. What do you need to do to the original string to create a new string of the indicated rotation? What pieces can you concatenate together to make the rotated alphabet? Given two strings, one the lower-case alphabet and one a rotated alphabet, how can you encode a given string? You need to go through each letter of the string to encode, find it in the regular alphabet, remember its locationfindex in that alphabet, then nd the letter in the rotated alphabet at the same index. The python method indexis helpful here. It indicates the location of a letter. Thus 'abcdef'.index{'c'] should return the value 2, the index of the letter 'c'. 'abcdef'.index{'bcd') retums l, where the beginning of the sequence 'bcd' occurs. 'xyz'.index('c'} returns - l, as 'c' does not occur in the string. When encoding a string, you should check to see if the letter from the original string is in the alphabet. You may use the in operator. 'a' in 'abcde' returns True. '.' in 'abcde' returns False. Decoding is probably the most complicated, best addressed last. You are given a string to decode and a word that occurs in the string. For example, the string 'this is a test\P ' l: r ' I1 Assignment Overview In this assignment, we are going to implement a simple encoding and decoding of text. As a result of working on this project, you will gain more experience with the use of: 1. string 2. if statement 3. for loop and while loop Background A rotation cipher is one of the simplest, plain-text ciphers, known since at least the time of Julius Caesar. It takes in a plain-text string, and translates it into a new string bated on a rotation ofthe alphabet being used. The basis is a \"rotation\

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions