Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Caesar-cipher/Python/caesar-cipher-1.py
Normal file
11
Task/Caesar-cipher/Python/caesar-cipher-1.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
def caesar(s, k, decode = False):
|
||||
if decode: k = 26 - k
|
||||
return "".join([chr((ord(i) - 65 + k) % 26 + 65)
|
||||
for i in s.upper()
|
||||
if ord(i) >= 65 and ord(i) <= 90 ])
|
||||
|
||||
msg = "The quick brown fox jumped over the lazy dogs"
|
||||
print msg
|
||||
enc = caesar(msg, 11)
|
||||
print enc
|
||||
print caesar(enc, 11, decode = True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue