Skip to content

Commit e8dcdc7

Browse files
authored
Update Caesar_Cipher.py
1 parent 5840acd commit e8dcdc7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Cryptography/Caesar_Cipher.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
"""
1+
'''
22
Aim: Given a string S , encrypt or decrypt it as per the choice entered by the user using Caesar Cipeher Substitution Method
33
44
Input Format:
55
1. The first line provides an option to the user to choose either to encrypt/decrypt
66
2. In the second line the user inputs the string as per his choice given in part 1.
77
88
Note : It is considered that the encrypted string consists of both upper and lowercase letters , while the decrypted strings consist of only uppercase letters.
9-
"""
10-
11-
from random import choice
9+
'''
1210

1311
def decrypt(encrypted_string,key_val):
1412
'''This is the decryption function
@@ -37,7 +35,6 @@ def encrypt(input_string,key_val):
3735
encrypt_char = 65 - ( 90 - encrypt_char)
3836
encrypt_char = chr(encrypt_char)
3937
final += encrypt_char
40-
final = ''.join(choice((str.upper, str.lower))(char) for char in final)
4138
return final
4239

4340
#DRIVER CODE
@@ -57,7 +54,7 @@ def encrypt(input_string,key_val):
5754
key_val = int(input('Enter the key value '))
5855
print('Decrypted string is : ' + decrypt(encrypted_string,key_val))
5956

60-
"""
57+
'''
6158
Sample Test Case :
6259
Case 1 :
6360
User chooses to input string and encrypt the inputted string.

0 commit comments

Comments
 (0)