I think there’s still an inconsistency here because the decryption doesn’t distinguish between the letter y and the number in y. I think it should have been D(y) = (a^-1)(j - b) to talk about it that way, but it seems easier to just use x,y instead.
D(y) = (a^-1)(y - b) mod m
Where:
D(y) is the numeric value of an encrypted letter, i.e., y = E(x)
Based on the description, the encryption function E(x) turns the letter x into an integer value, y. The encryption makes use of the integer i which is the index of x in the alphabet. The decryption function D(y) turns the integer y back into a letter. The decryption description is pretty explicit about that:
y is the numeric value of an encrypted letter, i.e., y = E(x)
The reason there is an inconsistency is because the description describes how a letter is encrypted as a number then decrypted from a number back to a letter.
What is glossed over in the description is that the solution you’re expected to write is supposed to use E(x) to compute an integer which is used to create a string. And, conversely, for the decryption, you need to convert a string to a series of integers which needs to be decrypted. The functions describe one portion of the exercise.
encrypt(intput) ==> apply E(x) for x in input ==> convert int to letter => combine to form an output
decrypt(intput) ==> convert letters to ints ==> apply D(y) for y in ints==> combine to form an output
The examples should make it clear that the encrypt and decrypt functions are not the full algorithm needed to solve this exercise.
With many of the exercises, the description doesn’t even attempt to provide the comprehensive requirements and details. It aims to give some context and the required background to understand what’s going on. The tests implement the requirements.