Question: Task 1 : Decrypting a Shift Cipher ( Caesar Cipher ) Problem Statement: You need to decrypt a string that was encrypted using a shift

Task 1: Decrypting a Shift Cipher (Caesar Cipher)
Problem Statement: You need to decrypt a string that was encrypted using a shift cipher (Caesar cipher).
Your Specific Inputs:
Encrypted String: "Xli$Tvstlix$,Tiegi$erh$Fpiwwmrkw$Fi$Ytsr$Lmq-$Wemh>$E$Qywpmq$mw$xli$sri$ ls$ezsmhw$levqmrk$Qywpmqw$ mxl$lmw$xsrkyi$sv$lmw$lerhw2$Erh$e$Qylenmv$,er$iqmkverx-$mw$xli$sri$ ls$kmziw$yt$,eferhsrw-$epp$ lex$Eppel$lew$jsvfmhhir2"
Your Student ID: 437102453
Key: 4
Python Code Snippet:def decrypt_caesar_cipher(input_str, key): decrypted_text ="" for char in input_str: if char.isalpha(): shift = ord(char)- key if char.islower(): if shift < ord('a'): shift +=26 elif char.isupper(): if shift < ord('A'): shift +=26 decrypted_char = chr(shift) else: decrypted_char = char decrypted_text += decrypted_char return decrypted_text if __name__=="__main__": encrypted_string ="" key =4 print(decrypt_caesar_cipher(encrypted_string, key))Expected Output: Your code should decrypt the given string using the key provided. The output should be readable English text.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!