I can't get an output with space characters
I have a cryptography project and want to decrypt sentences using python. I wrote this code but can't get an output, where the words have spaces between them. def vigenere_decrypt(key: str, text: str) -> str: decrypted_text = "" encrypted_text = text.replace(" ", "") key_length = len(key) for i, char in enumerate(encrypted_text): #ex. 0 y, 1 a... key_char = key[i % key_length] # ex. key = KEY, text = MESSAGE => KEYKEYK shifted_char = (ord(char) - (ord(key_char))) % 26 for c in text: if c in text == " ": decrypted_char = " " else: decrypted_char = chr((shifted_char) + ord('a')) decrypted_text +
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.