File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66
77def 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 :
You can’t perform that action at this time.
0 commit comments