new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 deletions
11
Task/Caesar_cipher/Python/caesar_cipher.py
Normal file
11
Task/Caesar_cipher/Python/caesar_cipher.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