new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 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