This repository was archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoperators.py
More file actions
69 lines (48 loc) · 1.48 KB
/
operators.py
File metadata and controls
69 lines (48 loc) · 1.48 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
63
64
65
66
67
68
69
"""
Collection of the core mathematical operators used throughout the code base.
"""
import math
# ## Task 0.1
# Implementation of a prelude of elementary functions.
def mul(x, y):
"""Implement multiply operation for 2 number
`f(x, y) = x * y`
Args:
x (float): first number
y (float): second number
Raises:
NotImplementedError: Raise when function is not implemented
"""
a = x*y
return a
raise NotImplementedError('Need to implement for Task 0.1')
def add(x, y):
"""Implement adding operation for 2 number
`f(x, y) = x + y`
Args:
x (float): first number
y (float): second number
Raises:
NotImplementedError: Raise when function is not implemented
"""
raise NotImplementedError('Need to implement for Task 0.1')
def neg(x):
"""Implement return negative version of a number
`f(x, y) = -x`
Args:
x (float): first number
y (float): second number
Raises:
NotImplementedError: Raise when function is not implemented
"""
raise NotImplementedError('Need to implement for Task 0.1')
def max(x, y):
"""Implement max operation for return the larger number of 2 number
`f(x, y) = x if x is greater than y else y`
Args:
x (float): first number
y (float): second number
Raises:
NotImplementedError: Raise when function is not implemented
"""
raise NotImplementedError('Need to implement for Task 0.1')