Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you explain the following codes doing line by line, like add comments to codes to show what the lines are doing: import sys def

Can you explain the following codes doing line by line, like add comments to codes to show what the lines are doing:

import sys def form_cube(n): i = 1 ret = [] while i*n<26: i+=1 j = 0 while j25): c-=26 temp.append(chr(ord('A')+c)) else: temp.append(chr(ord('a')+c)) k+=1 ret.append(temp) j+=1 return ret def search(s,lst): i = 0 while i25): print("key1 invalid value") exit(3) if(key2<0 or key2>25): print("key2 invalid value") exit(4) plain = "" try: f = open(fname) plain = f.read().lower() except: print("Could not open file") exit(5) cube = form_cube(key1) cipher = encrypt(plain,cube,key2) print(cipher)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions