new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
9
Task/Caesar-cipher/Python/caesar-cipher-3.py
Normal file
9
Task/Caesar-cipher/Python/caesar-cipher-3.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from string import ascii_uppercase as abc
|
||||
|
||||
def caesar(s, k, decode = False):
|
||||
trans = dict(zip(abc, abc[(k,26-k)[decode]:] + abc[:(k,26-k)[decode]]))
|
||||
return ''.join(trans[L] for L in s.upper() if L in abc)
|
||||
|
||||
msg = "The quick brown fox jumped over the lazy dogs"
|
||||
print(caesar(msg, 11))
|
||||
print(caesar(caesar(msg, 11), 11, True))
|
||||
Loading…
Add table
Add a link
Reference in a new issue