Skip to content

Commit 669595a

Browse files
committed
using sorted version of alpha for consistency
1 parent 20533a5 commit 669595a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

10_telephone/solution1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949
args = get_args()
5050
text = args.text
5151
random.seed(args.seed)
52-
alpha = string.ascii_letters + string.punctuation
52+
alpha = ''.join(sorted(string.ascii_letters + string.punctuation))
5353
len_text = len(text)
5454
num_mutations = round(args.mutations * len_text)
5555
new_text = text

10_telephone/solution2_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949
args = get_args()
5050
text = args.text
5151
random.seed(args.seed)
52-
alpha = string.ascii_letters + string.punctuation
52+
alpha = ''.join(sorted(string.ascii_letters + string.punctuation))
5353
len_text = len(text)
5454
num_mutations = round(args.mutations * len_text)
5555
new_text = list(text)

10_telephone/test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_now_cmd_s1():
7676
rv, out = getstatusoutput(f'{prg} -s 1 "{txt}"')
7777
assert rv == 0
7878
expected = """
79-
Now is B*e time X'r all good mem to come to the ,id of the party.
79+
Now is Ege time [dr all good me- to come to the jid of the party.
8080
""".strip()
8181
assert out.rstrip() == f'You said: "{txt}"\nI heard : "{expected}"'
8282

@@ -89,7 +89,7 @@ def test_now_cmd_s2_m4():
8989
rv, out = getstatusoutput(f'{prg} -s 2 -m .4 "{txt}"')
9090
assert rv == 0
9191
expected = """
92-
Nod ie .he(JiFe ?orvalldg/osxmenUt? cxxe.t$PtheOaidWEV:the xa/ty.
92+
No$ i% khefMiIe sor@all$glo<BmenYts cAAeltaTtheSaid[HYnthe Aalty.
9393
""".strip()
9494
assert out.rstrip() == f'You said: "{txt}"\nI heard : "{expected}"'
9595

@@ -101,7 +101,7 @@ def test_fox_file_s1():
101101
rv, out = getstatusoutput(f'{prg} --seed 1 {fox}')
102102
assert rv == 0
103103
txt = open(fox).read().rstrip()
104-
expected = "The 'uicq brown *ox jumps over the l-zy dog."
104+
expected = "The duic: brown hox jumps over the lkzy dog."
105105
assert out.rstrip() == f'You said: "{txt}"\nI heard : "{expected}"'
106106

107107

@@ -112,7 +112,7 @@ def test_fox_file_s2_m6():
112112
rv, out = getstatusoutput(f'{prg} --seed 2 --mutations .6 {fox}')
113113
assert rv == 0
114114
txt = open(fox).read().rstrip()
115-
expected = "V;xvq?ic# E]'Qy x/xdjumFs.o/U? th!Ulv'yrVox."
115+
expected = "ZoA@qric` HwdTB Alx$jumIslolXs th^Yl?dy<YoA."
116116
assert out.rstrip() == f'You said: "{txt}"\nI heard : "{expected}"'
117117

118118

0 commit comments

Comments
 (0)