Text Files · 12 / 17 Exercise Medium

Encrypt a text file

Objective

Create a Python program that makes a copy of a text file but encrypted.

Add the characters of each letter 13 times to encrypt the contents of the text file.

Files: read the file original.txt (it already exists) and save the encrypted copy in encrypted.txt. To encrypt, replace each letter (a-z, A-Z) with the letter 13 positions later in the alphabet, going back to the start after the Z (the alphabet has 26 letters); keep upper and lower case. Any other character stays unchanged. The program must not print anything.

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise