def main ): userInput - displayMenuAndGetOption ) if userInput-"E" or userInput "D": getFiles () elif userInput-"Q print ("nErrorInvalid option.") input ("nRun complete. Press the Enter key to exit.") def displayMenuAndGetoption ): print ("File Encryption Program\n") print ("E Encrypt a file\nD = Decrypt a file\nQ Quit the Program") userInput= input ("\nEnter menu selection (E, D, or Q) : ").upper() return userInput def getFiles 0: outFileopen ("encryptedFile.txt", "w") try: encrypt File open (input ("Enter the file to ENCRYPT. Press Enter alone to abort. "), 'r') except FileNotFoundError: print ("Error - that file does not exist. Try again.") convert (encryptFile, outFile) def convert (inputFile, outputFile): # Encryption and decryption are inverse of one another CODE = {'A' : ' ) ' , ' a' : ' 0' , 'B':'(','b':'9','C':'*','c':18',\

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 2E: Create a program named FileComparison that compares two files. First, use a text editor such as...
icon
Related questions
Question

How would I open a file and encrypt that file from a dictionary in Python? Attached is a picture of my current code. I am currently stuck at the getFiles() and convert(inputFile, outputFile) functions.

def main ):
userInput - displayMenuAndGetOption )
if userInput-"E" or userInput "D":
getFiles ()
elif userInput-"Q
print ("nErrorInvalid option.")
input ("nRun complete. Press the Enter key to exit.")
def displayMenuAndGetoption ):
print ("File Encryption Program\n")
print ("E Encrypt a file\nD = Decrypt a file\nQ Quit the Program")
userInput= input ("\nEnter menu selection (E, D, or Q) : ").upper()
return userInput
def getFiles 0:
outFileopen ("encryptedFile.txt", "w")
try:
encrypt File
open (input ("Enter the file to ENCRYPT. Press Enter alone to abort.
"),
'r')
except FileNotFoundError:
print ("Error - that file does not exist. Try again.")
convert (encryptFile, outFile)
def convert (inputFile, outputFile):
# Encryption and decryption are inverse of one another
CODE = {'A' : ' ) ' , ' a' : ' 0' , 'B':'(','b':'9','C':'*','c':18',\
Transcribed Image Text:def main ): userInput - displayMenuAndGetOption ) if userInput-"E" or userInput "D": getFiles () elif userInput-"Q print ("nErrorInvalid option.") input ("nRun complete. Press the Enter key to exit.") def displayMenuAndGetoption ): print ("File Encryption Program\n") print ("E Encrypt a file\nD = Decrypt a file\nQ Quit the Program") userInput= input ("\nEnter menu selection (E, D, or Q) : ").upper() return userInput def getFiles 0: outFileopen ("encryptedFile.txt", "w") try: encrypt File open (input ("Enter the file to ENCRYPT. Press Enter alone to abort. "), 'r') except FileNotFoundError: print ("Error - that file does not exist. Try again.") convert (encryptFile, outFile) def convert (inputFile, outputFile): # Encryption and decryption are inverse of one another CODE = {'A' : ' ) ' , ' a' : ' 0' , 'B':'(','b':'9','C':'*','c':18',\
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
InputStream
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L