Skip to content

Commit 9cc1d12

Browse files
committed
added secret_language file
1 parent 01ce7eb commit 9cc1d12

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

strings/secret_language.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55

66

77
def random_chars() -> str:
8-
"""
8+
'''
99
Generate a random string of 3 ASCII letters.
1010
1111
>>> import random
1212
>>> len(random_chars()) == 3
1313
True
14+
15+
1416
>>> all(c in string.ascii_letters for c in random_chars())
1517
True
16-
"""
18+
19+
20+
21+
'''
1722
return ''.join(random.choices(string.ascii_letters, k=3))
1823

1924

@@ -23,6 +28,9 @@ def random_digits() -> str:
2328
2429
>>> len(random_digits()) == 3
2530
True
31+
32+
33+
2634
>>> all(c in string.digits for c in random_digits())
2735
True
2836
"""
@@ -40,6 +48,8 @@ def encode(code: str) -> str:
4048
True
4149
>>> len(encode('hi')) == len('hi') + 12
4250
True
51+
52+
4353
"""
4454
if len(code) >= 3:
4555
code = code[1:] + code[0]
@@ -61,6 +71,9 @@ def decode(code: str) -> str:
6171
'hi'
6272
>>> decode(encode('python'))
6373
'python'
74+
75+
76+
6477
"""
6578
code = code[6:-6]
6679
if len(code) >= 3:

0 commit comments

Comments
 (0)