CodePudding user response:
S='abedgf'
Encrypted=[]
For num, STRS in enumerate (s) :
Encrypted. Append (CRH ((word (STRS) - num 1) % 10))
Print (encrypted)
CodePudding user response:
string='abcdefgefghigklmnopqrestuvwxyz'
Encrypted=[]
# encrypted string string
For index_num, char in enumerate (string) :
# print (word (char), index_num, end=' ')
# print ((word (char) - index_num) % 10)
Encrypted. Append (CRH ((word (char) - index_num) % 10))
# written into TXT file
With the open (' encryptedfile. TXT ', 'w +) as f:
For I in encrypted:
F.w rite (STR) (I)
# open a TXT file, decrypt
Decode_str='
With the open (' encryptedfile. TXT ', 'r') as f:
Decode=f.r ead ()
# decrypt read characters
For index_num, char in enumerate (decode) :
9 # don't ask me where come of, 9 is a guess, quotient, plus remainder is dividend, is the divisor is likely to be 9
Decode_str +=CRH (word (char) + 9 * 10 + index_num)
Print (decode_str)