-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.py
More file actions
34 lines (27 loc) · 695 Bytes
/
testing.py
File metadata and controls
34 lines (27 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# def add_positive_numbers(x, y):
# assert x > 0 and y > 0, "Both numbers must be positive!"
# return x + y
# print(add_positive_numbers(1, 1)) # 2
# add_positive_numbers(1, -1)
# def add(a, b):
# """
# >>> add(2, 3)
# 5
# >>> add(100,200)
# 300
# """
# return a * b
def double(values):
"""double the values in a list
>>> double([1,2,3,4])
[2, 4, 6, 8]
>>> double([])
[]
>>> double(['a', 'b', 'c'])
['aa', 'bb', 'cc']
>>> double([True, None])
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
"""
return [2 * element for element in values]