@@ -48,37 +48,37 @@ Exercises
4848
4949
5050
51-
51+
5252.. actex :: ex_8_2
5353
5454 In Robert McCloskey's
5555 book *Make Way for Ducklings *, the names of the ducklings are Jack, Kack, Lack,
56- Mack, Nack, Ouack, Pack, and Quack. This loop tries to output these names in order.
56+ Mack, Nack, Ouack, Pack, and Quack. This loop tries to output these names in order.
5757
5858 .. sourcecode :: python
59-
60- prefixes = "JKLMNOPQ"
59+
60+ prefixes = "JKLMNOPQ"
6161 suffix = "ack"
6262
6363 for p in prefixes:
6464 print(p + suffix)
65-
65+
6666 Of course, that's not quite right because Ouack and Quack are misspelled.
67- Can you fix it?
67+ Can you fix it?
6868 ~~~~
6969
70- prefixes = "JKLMNOPQ"
70+ prefixes = "JKLMNOPQ"
7171 suffix = "ack"
7272
7373 for p in prefixes:
7474 print(p + suffix)
75-
75+
7676 # Fix the loop to get the correct output.
7777
7878 ====
7979
8080 from unittest.gui import TestCaseGui
81-
81+
8282 class myTests(TestCaseGui):
8383 def testOne(self):
8484
@@ -120,8 +120,8 @@ Exercises
120120 def count(p):
121121 # your code here
122122
123- ====
124-
123+ ====
124+
125125 from unittest.gui import TestCaseGui
126126
127127 class myTests(TestCaseGui):
@@ -179,7 +179,7 @@ Exercises
179179
180180
181181.. actex :: ex_8_4
182-
182+
183183 Print out a neatly formatted multiplication table, up to 12 x 12.
184184 ~~~~
185185 # your code here
@@ -241,7 +241,7 @@ Exercises
241241 :practice: T
242242 :autograde: unittest
243243 :nocodelens:
244-
244+
245245 Write a function that reverses its string argument.
246246 ~~~~
247247 def reverse(astring):
@@ -253,10 +253,10 @@ Exercises
253253
254254 class myTests(TestCaseGui):
255255
256- def testOne(self):
257- self.assertEqual(reverse("happy"),"yppah","Tested reverse on input of 'happy'")
258- self.assertEqual(reverse("Python"),"nohtyP","Tested reverse on input of 'Python'")
259- self.assertEqual(reverse(""),"","Tested reverse on input of ''")
256+ def testOne(self):
257+ self.assertEqual(reverse("happy"),"yppah","Tested reverse on input of 'happy'")
258+ self.assertEqual(reverse("Python"),"nohtyP","Tested reverse on input of 'Python'")
259+ self.assertEqual(reverse(""),"","Tested reverse on input of ''")
260260
261261
262262
@@ -269,7 +269,7 @@ Exercises
269269
270270 .. tab :: Question
271271
272- Write a function that mirrors its string argument,
272+ Write a function that mirrors its string argument,
273273 generating a string containing the original string and the string backwards.
274274
275275 .. actex :: ex_8_6
@@ -344,10 +344,10 @@ Exercises
344344
345345 class myTests(TestCaseGui):
346346
347- def testOne(self):
348- self.assertEqual(remove_letter("a","apple"),"pple","Tested remove_letter on inputs of 'a' and 'apple'")
349- self.assertEqual(remove_letter("a","banana"),"bnn","Tested remove_letter on inputs of 'a' and 'banana'")
350- self.assertEqual(remove_letter("z","banana"),"banana","Tested remove_letter on inputs of 'z' and 'banana'")
347+ def testOne(self):
348+ self.assertEqual(remove_letter("a","apple"),"pple","Tested remove_letter on inputs of 'a' and 'apple'")
349+ self.assertEqual(remove_letter("a","banana"),"bnn","Tested remove_letter on inputs of 'a' and 'banana'")
350+ self.assertEqual(remove_letter("z","banana"),"banana","Tested remove_letter on inputs of 'z' and 'banana'")
351351
352352
353353
@@ -535,11 +535,11 @@ Exercises
535535
536536 class myTests(TestCaseGui):
537537
538- def testOne(self):
539- self.assertEqual(remove_all("an","banana"),"ba","Tested remove_all on inputs of 'an' and 'banana'")
540- self.assertEqual(remove_all("cyc","bicycle"),"bile","Tested remove_all on inputs of 'cyc' and 'bicycle'")
541- self.assertEqual(remove_all("iss","Mississippi"),"Mippi","Tested remove_all on inputs of 'iss' and 'Mississippi'")
542- self.assertEqual(remove_all("eggs","bicycle"),"bicycle","Tested remove_all on inputs of 'eggs' and 'bicycle'")
538+ def testOne(self):
539+ self.assertEqual(remove_all("an","banana"),"ba","Tested remove_all on inputs of 'an' and 'banana'")
540+ self.assertEqual(remove_all("cyc","bicycle"),"bile","Tested remove_all on inputs of 'cyc' and 'bicycle'")
541+ self.assertEqual(remove_all("iss","Mississippi"),"Mippi","Tested remove_all on inputs of 'iss' and 'Mississippi'")
542+ self.assertEqual(remove_all("eggs","bicycle"),"bicycle","Tested remove_all on inputs of 'eggs' and 'bicycle'")
543543
544544
545545
@@ -911,12 +911,12 @@ Exercises
911911
912912 class myTests(TestCaseGui):
913913
914- def testOne(self):
915- self.assertEqual(remove_dups("pooh"),"poh","Tested remove_dups on string 'pooh'")
916- self.assertEqual(remove_dups("mississippi"),"misp","Tested remove_dups on string 'mississippi'")
917- self.assertEqual(remove_dups("potato"),"pota","Tested remove_dups on string 'potato'")
918- self.assertEqual(remove_dups("bookkeeper"),"bokepr","Tested remove_dups on string 'bookkeeper'")
919- self.assertEqual(remove_dups("oo"),"o","Tested remove_dups on string 'oo'")
914+ def testOne(self):
915+ self.assertEqual(remove_dups("pooh"),"poh","Tested remove_dups on string 'pooh'")
916+ self.assertEqual(remove_dups("mississippi"),"misp","Tested remove_dups on string 'mississippi'")
917+ self.assertEqual(remove_dups("potato"),"pota","Tested remove_dups on string 'potato'")
918+ self.assertEqual(remove_dups("bookkeeper"),"bokepr","Tested remove_dups on string 'bookkeeper'")
919+ self.assertEqual(remove_dups("oo"),"o","Tested remove_dups on string 'oo'")
920920
921921 myTests().main()
922922
@@ -977,8 +977,8 @@ Exercises
977977
978978.. actex :: ex_8_22
979979 :timelimit: 60
980-
981- Modify this code so it prints each subtotal, the total cost, and average price
980+
981+ Modify this code so it prints each subtotal, the total cost, and average price
982982 to exactly two decimal places.
983983 ~~~~
984984 def checkout():
0 commit comments