1. Engineering
  2. Computer Science
  3. in pyhton 30 in this problem your input file will...

Question: in pyhton 30 in this problem your input file will...

Question details

IN PYHTON 3.0

In this problem, your input file will contain a number of key and ciphertext pairs, separated by a space. Each line is supposed to have one such pair. You may assume that the ciphertext contains only uppercase letters. For example the pair:

2 JGNNQ

However, it is possible that the ciphertext and even the key may be missing, and your program should handle this case.

The ciphertext has been encrypted by shifting letters in the alphabet by the amount specified by the key. The word HELLO with key = 2 becomes JGNNQ. Letters should wrap around, so PIZZA with key = 1 becomes QJAAB. If the ciphertext is missing, your program should output a message "Missing text!".   The sample run below is for the inputs from secret_code.txt:

Sample Run

[evaluate codebreaker]
Enter the input filename: secret_code.txt
PYTHON
Missing text!
ALBERTA
SUN
Missing text!
CMPUT
UNIVERSITY

The input file is not given here. You have to create your own input file with the content as described: each line has a key and ciphertext pair, separated by a space.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution