Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain in detail what each part of the code does to get the outcome NA = 1 2 3 4 4 def decryption(key, message):
Please explain in detail what each part of the code does to get the outcome
NA = 1 2 3 4 4 def decryption(key, message): message message. upper() alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" result = print(key) for letter in message: if letter in alpha: letter_index (alpha.find(letter) - key) % len(alpha) 5 6 7 8 00 result = result + alpha[letter_index] else: result = result + letter return result 9 10 11 12 13 14 15 16 17 18 19 def main(): filename = "ceaserEncrypted.txt" ceaser_list = [] # file reading with open(filename) as file_in: ceaser_list [] for line in file_in: ceaser_list.append(line) 20 21 22 23 24 25 = 26 27 decrypted_list [] # store key key = int(ceaser_list[@]) # decrypt every message for message in ceaser_list[1:]: decrypted decryption(key, message) decrypted_list.append(decrypted) 28 29 30 31 32 33 34 35 36 37 # make output file file1 = open("ceaserDecrypted.txt", "w") = # write to output file for mesage in decrypted_list: file1.write(mesage) 38 39 40 main()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