Skip to content

Commit cdc1d7a

Browse files
committed
mionor
1 parent 2127b5f commit cdc1d7a

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

v3/tests/doctest-tests/labtiny.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# some examples adapted from https://docs.python.org/2/library/doctest.html
2+
3+
'''
4+
5+
LAB_NAME = "First doctest lab"
6+
7+
LAB_DESCRIPTION =
8+
This is my first **lab** in [markdown](https://daringfireball.net/projects/markdown/syntax) format
9+
10+
- shawn
11+
- is
12+
- cool
13+
14+
woohoo!
15+
16+
'''
17+
18+
19+
# helper function written by student, not part of the lab
20+
def add(x, y):
21+
return x + y
22+
23+
24+
def slow_multiply(a, b):
25+
"""
26+
Lab part 2
27+
28+
Return the product of 'a' and 'b'
29+
30+
------
31+
32+
>>> print slow_multiply(3, 5)
33+
15
34+
35+
"""
36+
37+
38+
i = 0
39+
prod = 0
40+
for i in range(b):
41+
prod = add(prod, a)
42+
return prod

0 commit comments

Comments
 (0)