Good job! Here comes the next exercise.
The only difference between a cipher and a decipher function would be the subtraction of the shift value instead of addition. However, you must know the value the letters were shifted by, otherwise, it wouldn't be a cipher at all.
You don't have to create a separate decipher function. The
cipher() function perfectly fits our needs. As you already know, it just shifts the letters by a particular value between
25. If you shift the ciphered word the correct number of times, you will "return" to the beginning value, e.g.:
word = "Python"
ciphered_word = cipher(word, 12) # we shift the letters by 12
deciphered_word = cipher(ciphered_word, -12) # we shift the letters by -12 places thus returning to the beginning.
Of course we don't know that
12 is the correct number. We have to iterate through every possibility (in a range from
0 inclusive) and create a set of all result words.