Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 9, Problem 3PE

File Encryption and Decryption

Write a program that uses a dictionary to assign "codes" to each letter of the alphabet. For example:

codes = { 'A' :, '%', 'a' : '9', 'B' : '@', 'b' : '#', etc . . .}

Using this example, the letter A would be assigned the symbol %, the letter a would be assigned the number 9, the letter B would be assigned the symbol @, and so forth. The program should open a specified text file, read its contents, then use the dictionary to write an encrypted version of the file’s contents to a second file. Each character in the second file should contain the code for the corresponding character in the first file.

Write a second program that opens an encrypted file and displays its decrypted contents on the screen.

Blurred answer
Students have asked these similar questions
The assignment here is to write an app using a database named CIT321 with a collection named students; we will provide a CSV file of the data. You need to use Vue.js to display 2 pages. You should know that this assignment is similar, all too similar in fact, to the cars4sale2 example in the lecture notes for Vue.js 2. You should study that program first. If you figure out cars4sale2, then program 6 will be extremely straightforward. It is not my intent do drop a ton of new material here in the last few days of class. The database contains 51 documents. The first rows of the CSV file look like this: sid last_name 1 Astaire first_name Humphrey CIT major hrs_attempted gpa_points 10 34 2 Bacall Katharine EET 40 128 3 Bergman Bette EET 42 97 4 Bogart Cary CIT 11 33 5 Brando James WEB 59 183 6 Cagney Marlon CIT 13 40 GPA is calculated as gpa_points divided by hrs_attempted. GPA points would have been arrived at by adding 4 points for each credit hour of A, 3 points for each credit hour of...
I need help to solve the following case, thank you
hi I would like to get help to resolve the following case

Chapter 9 Solutions

Starting Out with Python (4th Edition)

Ch. 9.1 - Prob. 11CP Ch. 9.1 - Prob. 12CP Ch. 9.1 - What does the values method return? Ch. 9.2 - Prob. 14CP Ch. 9.2 - Prob. 15CP Ch. 9.2 - Prob. 16CP Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - Prob. 22CP Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - After the following statement executes, what... Ch. 9.2 - Prob. 25CP Ch. 9.2 - Prob. 26CP Ch. 9.2 - After the following code executes, what elements... Ch. 9.2 - Prob. 28CP Ch. 9.2 - After the following code executes, what elements... Ch. 9.2 - After the following code executes, what elements... Ch. 9.2 - After the following code executes, what elements... Ch. 9.2 - Prob. 32CP Ch. 9.3 - Prob. 33CP Ch. 9.3 - When you open a file for the purpose of saving a... Ch. 9.3 - When you open a file for the purpose of retrieving... Ch. 9.3 - Prob. 36CP Ch. 9.3 - Prob. 37CP Ch. 9.3 - Prob. 38CP Ch. 9 - You can use the __________ operator to determine... Ch. 9 - You use ________ to delete an element from a... Ch. 9 - The ________ function returns the number of... Ch. 9 - You can use_________ to create an empty... Ch. 9 - The _______ method returns a randomly selected... Ch. 9 - The __________ method returns the value associated... Ch. 9 - The __________ dictionary method returns the value... Ch. 9 - The ________ method returns all of a dictionary's... Ch. 9 - The following function returns the number of... Ch. 9 - Prob. 10MC Ch. 9 - Prob. 11MC Ch. 9 - This set method removes an element, but does not... Ch. 9 - Prob. 13MC Ch. 9 - Prob. 14MC Ch. 9 - This operator can be used to find the difference... Ch. 9 - Prob. 16MC Ch. 9 - Prob. 17MC Ch. 9 - The keys in a dictionary must be mutable objects. Ch. 9 - Dictionaries are not sequences. Ch. 9 - Prob. 3TF Ch. 9 - Prob. 4TF Ch. 9 - The dictionary method popitem does not raise an... Ch. 9 - The following statement creates an empty... Ch. 9 - Prob. 7TF Ch. 9 - Prob. 8TF Ch. 9 - Prob. 9TF Ch. 9 - Prob. 10TF Ch. 9 - What will the following code display? dct =... Ch. 9 - What will the following code display? dct =... Ch. 9 - What will the following code display? dct =... Ch. 9 - What will the following code display? stuff =... Ch. 9 - How do you delete an element from a dictionary? Ch. 9 - How do you determine the number of elements that... Ch. 9 - Prob. 7SA Ch. 9 - What values will the following code display? (Dont... Ch. 9 - After the following statement executes, what... Ch. 9 - After the following statement executes, what... Ch. 9 - After the following statement executes, what... Ch. 9 - After the following statement executes, what... Ch. 9 - After the following statement executes, what... Ch. 9 - What will the following code display? myset =... Ch. 9 - After the following code executes, what elements... Ch. 9 - Prob. 16SA Ch. 9 - Prob. 17SA Ch. 9 - Prob. 18SA Ch. 9 - After the following code executes, what elements... Ch. 9 - Prob. 20SA Ch. 9 - Write a statement that creates a dictionary... Ch. 9 - Write a statement that creates an empty... Ch. 9 - Assume the variable dct references a dictionary.... Ch. 9 - Assume the variable dct references a dictionary.... Ch. 9 - Prob. 5AW Ch. 9 - Prob. 6AW Ch. 9 - Prob. 7AW Ch. 9 - Prob. 8AW Ch. 9 - Prob. 9AW Ch. 9 - Prob. 10AW Ch. 9 - Assume the variable dct references a dictionary.... Ch. 9 - Write code that retrieves and unpickles the... Ch. 9 - Course information Write a program that creates a... Ch. 9 - Capital Quiz The Capital Quiz Problem Write a... Ch. 9 - File Encryption and Decryption Write a program... Ch. 9 - Unique Words Write a program that opens a... Ch. 9 - Prob. 5PE Ch. 9 - File Analysis Write a program that reads the... Ch. 9 - World Series Winners In this chapters source code... Ch. 9 - Name and Email Addresses Write a program that... Ch. 9 - Blackjack Simulation Previously in this chapter... Ch. 9 - Word Index Write a program that reads the contents...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
What class do you use to write data to a file?

Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)

Suppose a multiprogramming operating system allocated time slices of 10 milliseconds and the machine executed a...

Computer Science: An Overview (13th Edition) (What's New in Computer Science)

Knowledge Booster
Background pattern image
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.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    C++ for Engineers and Scientists
    Computer Science
    ISBN:9781133187844
    Author:Bronson, Gary J.
    Publisher:Course Technology Ptr
    Text book image
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
    Text book image
    Programming Logic & Design Comprehensive
    Computer Science
    ISBN:9781337669405
    Author:FARRELL
    Publisher:Cengage
    Text book image
    Programming with Microsoft Visual Basic 2017
    Computer Science
    ISBN:9781337102124
    Author:Diane Zak
    Publisher:Cengage Learning
    Text book image
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
    Dictionaries - Introduction to Data Structures (Episode 8); Author: NullPointer Exception;https://www.youtube.com/watch?v=j0cPnbtp1_w; License: Standard YouTube License, CC-BY