-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from agiliq/develop
Added more scripts
- Loading branch information
Showing
6 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from string import ascii_uppercase as upr, ascii_lowercase as lwr | ||
|
||
def caesar_cipher(txt, offset=1): | ||
_map = dict(list(zip(upr, upr[offset:] + upr[:offset])) + list((zip(lwr, lwr[offset:] + lwr[:offset])))) | ||
return "".join([_map[el] if el in upr+lwr else el for el in txt]) | ||
|
||
def test_caesar_cipher(): | ||
assert caesar_cipher('attack at dawn') == 'buubdl bu ebxo' | ||
assert caesar_cipher('attack at dawn', offset=5) == 'fyyfhp fy ifbs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import uuid | ||
print(uuid.uuid4()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
from string import ascii_uppercase as upr, ascii_lowercase as lwr | ||
|
||
def rot13(txt): | ||
map = dict(list(zip(upr, upr[13:] + upr[:13])) + list((zip(lwr, lwr[13:] + lwr[:13])))) | ||
return "".join([map[el] for el in txt]) | ||
_map = dict(list(zip(upr, upr[13:] + upr[:13])) + list((zip(lwr, lwr[13:] + lwr[:13])))) | ||
return "".join([_map[el] if el in upr+lwr else el for el in txt]) | ||
|
||
|
||
def test_rot13(): | ||
assert rot13('this text will transform') == 'guvf grkg jvyy genafsbez' |
File renamed without changes.