Hello I'm having some trouble with my python code in making a Caesar's cipher. First, I'm only supposed to use one global constant , ALPHABET, but I don't think I can import string. So should I just include every alphabet letter in a bracket ( for ex: [A, B, C....].lower() ) or is there another method? In lines 18 and 19, I have i = ALPHABET.index(char) and encodeMessage += cipher[i] but should I replace the variable i with another variable name, since in line 17, I don't have it listed as , for char in message(i)? Instructions: The main() function will prompt the user for two values: a text message string consisting of only alphabetic characters and spaces, and a key value between 1 and 26. You will have one global constant list called ALPHABET, which will have lowercase letters and the space (in the order shown above) as elements In addition to main, your program will have 3 functions: The generateCipher() function will accept the parameter key and will generate and return the cipher alphabet list. Hint: create the cipher list by slicing the plaintext alphabet list (using the key), and return it.
Hello I'm having some trouble with my python code in making a Caesar's cipher. First, I'm only supposed to use one global constant , ALPHABET, but I don't think I can import string. So should I just include every alphabet letter in a bracket ( for ex: [A, B, C....].lower() ) or is there another method? In lines 18 and 19, I have i = ALPHABET.index(char) and encodeMessage += cipher[i] but should I replace the variable i with another variable name, since in line 17, I don't have it listed as , for char in message(i)? Instructions: The main() function will prompt the user for two values: a text message string consisting of only alphabetic characters and spaces, and a key value between 1 and 26. You will have one global constant list called ALPHABET, which will have lowercase letters and the space (in the order shown above) as elements In addition to main, your program will have 3 functions: The generateCipher() function will accept the parameter key and will generate and return the cipher alphabet list. Hint: create the cipher list by slicing the plaintext alphabet list (using the key), and return it.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Hello I'm having some trouble with my python code in making a Caesar's cipher. First, I'm only supposed to use one global constant , ALPHABET, but I don't think I can import string. So should I just include every alphabet letter in a bracket ( for ex: [A, B, C....].lower() ) or is there another method?
In lines 18 and 19, I have i = ALPHABET.index(char) and encodeMessage += cipher[i] but should I replace the variable i with another variable name, since in line 17, I don't have it listed as , for char in message(i)?
Instructions:
- The main() function will prompt the user for two values: a text message string consisting of only alphabetic characters and spaces, and a key value between 1 and 26.
- You will have one global constant list called ALPHABET, which will have lowercase letters and the space (in the order shown above) as elements
- In addition to main, your program will have 3 functions:
- The generateCipher() function will accept the parameter key and will generate and return the cipher alphabet list. Hint: create the cipher list by slicing the plaintext alphabet list (using the key), and return it.
- The encodeMessage () function will accept as parameters a string containing the plaintext message and the cipher alphabet list, and will return a string with the encoded message
- The decodeMessage () function will accept as parameters a string containing an encoded message and the cipher alphabet list, and will return a string with the plaintext message. If the original message contained uppercase letters, those will NOT be restored (they will be shown in lowercase).
- You may not use any global variables other than the constant(s) mentioned above
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education