import pyperclip
#Cesar Chiper
#The String to be encrypt or decrypted
message = "This is my secret message"
#The encryption /decryption key
key = 13
#Tell the program to encrypt/decrypt
mode = "encrypt"
#Every possible sympol to encrypt or decrypt from the message
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#Stores message
translated=""
message = message.upper()
#run the encryption/decryption code in each symbol in the message string
for symbol in message:
if symbol in letters:
#get the encypted or deycrypted number for this symbol
num = letters.find(symbol)
if mode == "encrypt":
num = num + key
elif mode == "decrypt":
num = num - key
#handle the wrap around if num is larger than lenght of letters or less than 0
if num >= len(letters):
num = num - len(letters)
elif num < 0:
num = num + len(letters)
#ad encrypted/decrypted number symbol at the end of translted
translated = translated + letters[num]
else:
#Just add the symbol without encrypting/decrypting
translated = translated + symbol
#print the encrypted/decrypted to screen
print(translated)
#copy the encrypted/decrypted string to clipoard
pyperclip.copy(translated)
Hei。我发现您的代码中只有indent