Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

KEY = BOB def encode_phrase(phrase, key): result = k = 0 for i in range(len(phrase)): if phrase[i].isalpha(): result += KEY[k]+ str(findDiff(phrase[i],key[k])) k+= 1 else:

KEY = "BOB" def encode_phrase(phrase, key): result = "" k = 0 for i in range(len(phrase)): if phrase[i].isalpha(): result += KEY[k]+ str(findDiff(phrase[i],key[k])) k+= 1 else: result += phrase[i] if k == len(KEY): k = 0 return result def decode_phrase(phase, key): def findDiff(letter1,letter2): diff = ord(letter1) - ord(letter2) if diff < 0: diff += 26 return diff 
How would I make a function that decodes the result that encode_phrase encodes?

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

Students also viewed these Databases questions