File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ def encrypt (letter , s ):
2+ if (letter .isupper ()):
3+ return chr ((ord (letter ) + s - 65 ) % 26 + 65 ) #for uppercase input string
4+ elif (letter .islower ()):
5+ return chr ((ord (letter ) + s - 97 ) % 26 + 97 ) #for smallercase input string
6+ else :
7+ return letter
8+
9+ text = input ("Enter the word: " )
10+ s = int (input ("Enter the shift: " ))
11+ shift = [s ] * len (text ) #shifts the alphabet by input spaces in the english alphabet
12+ result = list (map (encrypt , text , shift ))
13+
14+ print ("Encrypted text: " , end = "" )
15+ for i in result :
16+ print (i , end = "" )
Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ This repository contains **Some mini projects** implemented in **Python**
3838
3939* [ commandline_tool] ( commandline_tool/Command%20Line%20Tool.ipynb )
4040
41+ ### Python Ceaser Cipher
42+
43+ ![ image] ( https://user-images.githubusercontent.com/68952200/136580945-a477e47e-52aa-41e1-9459-c51f3eee4077.png )
44+
45+
4146---
4247
4348## Author
You can’t perform that action at this time.
0 commit comments