-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcode.py
More file actions
62 lines (49 loc) · 1.51 KB
/
code.py
File metadata and controls
62 lines (49 loc) · 1.51 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import numpy as np
def sum_numbers(x, y):
"""
TODO: IMPLEMENT ME
Sum two numbers.
Args:
x (int, float): first number in sum
y (int, float): second number in sum
Returns:
Sum of x and y.
"""
# replace the following line with an actual implementation that returns something
raise NotImplementedError()
def multiply_numbers(x, y):
"""
TODO: IMPLEMENT ME
Multiply two numbers.
Args:
x (int, float): first number in product
y (int, float): second number in product
Returns:
Product of x and y.
"""
# replace the following line with an actual implementation that returns something
raise NotImplementedError()
def create_add_matrix(x):
"""
TODO: IMPLEMENT ME
Step 1. Create a 3x3 numpy array whose elements are all ones.
Step 2. Sum the array and the input array x.
Step 3. Return the result
Args:
x (np.ndarray): a 2D numpy array
Returns:
output (np.ndarray): the operation result
"""
# replace the following line with an actual implementation that returns something
raise NotImplementedError()
def indexing_aggregation(x, n):
"""
TODO: IMPLEMENT ME
Return the mean value of the first n elements of the input array x.
Args:
x (np.ndarray): a 1D numpy array
Returns:
output (float): the operation result
"""
# replace the following line with an actual implementation that returns something
raise NotImplementedError