Question
You have been given an encrypted copy of the Exam2 study guide hereExam2 study guide here, but how do you decrypt and read it ???Exam2
You have been given an encrypted copy of the Exam2 study guide hereExam2 study guide here, but how do you decrypt and read it???Exam2 study guide here
Along with the encrypted copy, some mysterious person has also given you the following documents:
helloworld.txhelloworld.txtt -- Maybe this file decrypts to say "Hello world!". Hmmm.helloworld.txt
hints.txthints.txt -- Seems important.hints.txt
In a file called pa07.py write a program that askes for two pieces of information: 1) the file to read, and 2) the file to write. Make sure to ask for the files in that order to get the most points. The first input should be the name of an encoded file (either helloworld.txt or superdupertopsecretstudyguide.txt or yet another file that I might use to test your code). The second should be the name of a file that you will use as an output file. For example:
Please enter the input file: superDuperTopSecretStudyGuide.txt
Please enter the output file: translatedguide.txt
Your program should read in the contents of the inputfile and, using the scheme described in the hints.txt file above, decode the hidden message, writing to the outputfile as it goes (or all at once when it is done depending on what you decide to use).
Note: If you are in Windows, please read the textfiles in Wordpad (not Notepad). I've converted the files to an encoding that is readable by both Windows and Mac machines. Mac machines natively process newlines a little different than Windows machines, so if you open the file in Notepad, you'll notice it is all on one line. That's ok -- Wordpad understands the encoding and will show you the file with the proper newlines inside.
Hint: The penny math lecture is here.here
""" Program: pennyMath.py Author: CS 1510 Description: Calculates the penny math value of a string. """ # Get the input string original = input("Enter a string to get its cost in penny math: ") cost = 0 # Go through each character in the input string for char in original: value = ord(char) #ord() gives us the encoded number! if char>="a" and char<="z": cost = cost+(value-96) #offset the value of ord by 96 elif char>="A" and char<="Z": cost = cost+(value-64) #offset the value of ord by 64 print("The cost of",original,"is",cost)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started