Question: two functions fxn cipher amp decipher to cipher amp decipher...
Two Functions (fx'n): Cipher & Decipher:
To cipher & decipher data, we need 2 fx'ns - 1 to take a string & change it to something else. You use the ord f'xn & add the 'key' to result in a new string. Let's say x is one letter to be ciphered & the key is 4. This is what we would do: Updatedx=ord(x)+4 Updatedx = integer. Or, you can use the chr fx'n to see what letter the integer represents: realLetter = chr(x)
THIS IS BEGINNER PYTHON - NO COMPLEX ANSWERS PLEASE
Write a fx'n called secret that takes a string & a key [integer]. The fx'n ciphers the string into a different string & returns the new string. Please be aware that when we reach "z", we must 'roll' into the alphabet once more. Therefore, ord('z')+4 should give us ord('d') (from above example)
Write another fx'n called decode, given a string & a key, it returns the deciphered string.
From main, write code to: get a string & an int(eger) as input, call the secret fx'n, & print its output. Finally, call the decode fx'n & display its output. The decipher/decode output should match the original string.