Question: PLEASE HELP ME FIX THIS CODES FOR THIS PROBLEMSProblem 1 : Complete the function affine _ encrypt ( text , a , b ) that
PLEASE HELP ME FIX THIS CODES FOR THIS PROBLEMSProblem :
Complete the function affineencrypttext a b that returns the cipher text encrypted
using key You must verify that the before making the encryption. If
the function must raise a ValueError exception with message "The
given key is invalid."
def affineencrypttext :
encrypts the plaintext 'text', using an affine transformation key
:param: text str type; plaintext as a string of letters
:param: a int type; integer satisfying
nverthtmOneDriveDocumentsTeaching MaterialsCECS Programming AssignmentsPA CECS Progra...
CECS Programming Assignment #
:param: b int type; shift value
: raise: ValueError if is not
:return: str type; the encrypted message as string of uppercase letters
n nn
# FIXME: raise an error if the is not
cipher
for letter in text:
if letter.isalpha:
# FIXME: Use
util.py to initialize 'num' to be
# the integer corresponding to the current letter
num None
# FIXME: Encrypt the current 'num' using the
# affine transformation with key
# Store the result in cipherdigits.
cipherdigits "None"
if lencipherdigits :
# FIXME: If the cipherdigit is
# prepend the string with
# to make it a twodigit number
cipherdigits None
# FIXME: Use
util.py to append to the cipher the ENCRYPTED letter
# corresponding to the current cipher digits
cipher 'None"
return cipher
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
