Answer:
def encrypt_text(text,value):
encoded = ""
for i in range(len(text)):
char = text[i]
if (char.isupper()):
encoded += chr"po"ord'po'char'pc' + value -65'pc' % 26 + 65'pc'
else:
encoded += chr'po'ord'po'char'pc' + value -97'pc' % 26 + 97'pc'
return encoded
plaintext = input("Enter sentence of encrypt: ")
dist_value = int(input("Enter number: "))
encrypted = encrypt_text(plaintext, dist_value)
print(encrypted)
Explanation:
The python program above is a Ceasar cipher implementation. The encrypt_text function is defined to accept text input and a distance value, which is used to encrypt the plaintext.
The user can directly input text and the distance value from the prompt and get the encrypted text printed on the screen.