Skip to content

Commit 2e5033d

Browse files
committed
Fixed the format error on intro page
1 parent d5bf5a8 commit 2e5033d

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

_sources/dictionaries/mc_intro.rst

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,34 @@ See the video below for an example.
108108
:align: center
109109

110110
Finish writing the code for the following problem.
111-
.. writecode:: intro-sample-write-code-double-mooc_nested
112-
:numbered: left
113-
:adaptive:
114-
:practice: T
115111

116-
Write a function called ``double(num)`` that takes a number ``num`` and
117-
returns the number times 3. For example, ``double(3)`` should return 6 and ``double(-4)`` should return -8.
118-
-----
119-
def double(num):
120-
# Your code here
121-
pass
112+
.. activecode:: intro-sample-write-code-double-mooc_nested
113+
:autograde: unittest
114+
:nocodelens:
115+
116+
Write a function called ``double(num)`` that takes a number ``num`` and
117+
returns the number times 2. For example, ``double(3)`` should return 6 and ``double(-4)`` should return -8.
118+
~~~~
119+
def double(num):
120+
# Your code here
121+
pass
122+
123+
print(double(2))
124+
print(double(-1))
125+
126+
====
127+
from unittest.gui import TestCaseGui
128+
class myTests(TestCaseGui):
129+
130+
def testOne(self):
131+
self.assertEqual(double(2),4,"double(2)")
132+
self.assertEqual(double(3),6,"double(3)")
133+
self.assertEqual(double(-1),-2,"double(-1)")
134+
self.assertEqual(double(0),0,"double(0)")
135+
self.assertEqual(double(11),22,"double(11)")
136+
137+
myTests().main()
138+
122139

123140

124141
Solving Write Code Problems with an Adaptive Mixed-up Puzzle as Scaffolding

0 commit comments

Comments
 (0)