hello
I am trying to make python decrypt a long string into the message
but it seems to be something wrong with my program
I have not done any programming before
and I hope that you help me to understand this one perfectly
here is the quistion
Test 1 - simple phrase, standard shift
>>> decrypt('wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj', 3)
'the quick brown fox jumps over the lazy dog'
and here what I have done so far
I am trying to make python decrypt a long string into the message
but it seems to be something wrong with my program
I have not done any programming before
and I hope that you help me to understand this one perfectly
here is the quistion
Test 1 - simple phrase, standard shift
>>> decrypt('wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj', 3)
'the quick brown fox jumps over the lazy dog'
and here what I have done so far
Code:
def decrypt(ciphertext, shift):
"""
Decrypts some ciphertext encrypted with the Caesar cipher. Uses the
shift to do the decryption.
"""
newtxt = 'wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj'
for i in range(len (newtxt)):
if newtxt[i]== ciphertext:
return newtxt [(i - shift )%len (newtxt)]
return newtxt
Comment