Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use the python program to answer it thanks Part III: The Double Cipher: Map Character to Coordinates (10 points) Write a function map.char.to.coords that
Please use the python program to answer it thanks Part III: The Double Cipher: Map Character to Coordinates (10 points) Write a function map.char.to.coords that takes one argument: filename, which is a file that will be used to build the first of the two dictionaries for implementing the Double Cipher algorithm. The file represents a encryption key/mechanism. In the file, you will find uppercase letters (A-Z) and digits (0-9) randomly spread in a 6 x 6 shaped grid. In each row, you will find letters and/or numbers separated by spaces For example, the contents of a sample file looks like this 1 PIYEU 9c3w5 The grid has 6 rows (numbered 1-6) and 6 columns (also numbered 1-6). The function creates a dictionary that maps every letter or number to its coordinates (row, col) as a tuple in a dictionary. In the end, the function returns the dictionary built from the file above. For example, for the letter T' in the above file, it should be mapped in the dictionary with the key being 'T and the value being (3,4).Similarly, the number 5 will have a key 5 and a value (4,6) Examples Return Value Function Call map.char.to-coords ('keyl.txt' SeeMapping 1' below map.char.to.coords ('key2.txt' See Mapping 2' below map.char.to.coords('key3.txt') See Mapping 3' below Note: Sample key files have been provided to you on Piazza (key1.txt, key 2.txt and key3.txt). Also, the order of the key/value pairs in the dictionary generated by your code will not necessarily match the examples below because a dictionary doesn't keep its content in any meaningful order. Mapping 1: (keyl.txt) M -, 6) K - (6, 2) U -(2, 6) R - (5, 4) 4-(6, 3) 2 - (3, 6) 3 -(4, 4) P -(2, 2) S -(5, 5) G -(5, 2) Q-, 5) -> (3, 3) D - (3, 5) 5-(4, 6) o -(6, 4) Y-(2, 4) W-4, 5) E -(2, 5) 9-(4, 2)
Please use the python program to answer it thanks
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