I recently created a code snippet that does pretty much what you say. It takes a code word, such as "abc'gets values (1, 2, 3), and then adds them to each letter in the word for encryption. Therefore, if" abc "was a code word and" bcd "is the text to be encrypted. (1 + 2 = 3 2 + 3 = 5 and 3 + 4 = 7), so the output will be "ceg"
codeword = input('Enter codeword : ')
codeword = codeword.replace(" ", "")
encrypt = input('Enter text to encrypt : ')
encrypt = encrypt.replace(" ", "")
j = 0
for i in codeword:
print(chr(ord(encrypt[j])+ ord(codeword[j])-96))
j+=1
source
share