Question: PLEASE WRITE IN PYTHON USING JUPYTER NOTEBOOK Create a function affineEncrypt(text, a,b ) that returns the cipher text encrypted using key (a,b). You must verify


PLEASE WRITE IN PYTHON
USING JUPYTER NOTEBOOK
Create a function affineEncrypt(text, a,b ) that returns the cipher text encrypted using key (a,b). You must verify that the gcd(a,26)=1 before making the encryption. If this is not the case, the function must raise a ValueError with message "The given key is invalid. The gcd(a,26) must be 1.". You may NOT use any built-in functions as part of your implementation, but you may use any functions you implemented in previous coding assignments. Please make sure to copy and paste them into this file, so that they are uploaded to CodePost when you submit your pa3.py file. def affineEncrypt (text, a,b) : "" "encrypts the plaintext 'text', using an affine transformation key (a, b) INPUT: text - plaintext as a string of letters a-integersatisfyinggcd(a,26)=1.Raiseserrorifsuchisnotthecasb-integer OUTPUT: The encrypted message as a string of characters "N" pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
