In cryptography, the intended message sometimes consists of the first letter of
ID: 3767743 • Letter: I
Question
In cryptography, the intended message sometimes consists of the first letter of every word in a string. Write a function crypt that will receive one input string: the encrypted message. The function will return one string (the intended message) consisting of the first letter of every word in the input string. The function should return an appropriate value for input strings of any size. An example of a function call would look like this: >> estring = 'The early songbird tweets'; >> m = crypt (estring) m = TestExplanation / Answer
def getMode():
while True:
print('Do you wish to encrypt a message?')
mode = input().lower()
if mode in 'encrypt'.split():
return mode[0]
else:
print('Enter either "encrypt" or "e"')
mode = getMode()
message = getMessage()
if mode[0] != 'e':
key = getKey()
print('Your translated text is:')
if mode[0] != 'e':
print(getTranslatedMessage(mode, message, key))
else:
for key in range(1, MAX_KEY_SIZE + 1):
print(key, getTranslatedMessage('encrypt', message, key))
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.