Merhaba, Sezar Şifreleme komutu oluşturdum pythonda fakat texte büyük harfle girdiğimde çalışmıyor. Kod aşağıda yardımcı olabilir misiniz?
Kod:
def main():
Encryption= "e"
Decryption="d"
print("please select the operation 'e'for encryption,")
print( " 'd' for decryption")
choice=input("Encryption / Decryption ")
text=input("write your plain text: ")
shift=int(input("write your shift amount: "))
if choice=="e" or choice=="E":
encrypted(text,shift)
elif choice=="d" or choice=="D":
decrypted(text,shift)
else:
print("Error! Invalid choice")
choice=input("enter your choice: ")
def encrypted(text,shift):
encrypted_text = ''
alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
]
for i in text:
if i not in alphabet:
encrypted_text += i
else:
encrypted_text += alphabet[
(alphabet.index(i)+shift) % len(alphabet)]
print("Chiper Text:", encrypted_text)
return main()
def decrypted(text,shift):
decrypted_text = ''
alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
]
for i in text:
if i not in alphabet:
decrypted_text += i
else:
decrypted_text += alphabet[
(alphabet.index(i)-shift) % len(alphabet)]
print("Chiper Text:", decrypted_text)
return main()
main()