-
Notifications
You must be signed in to change notification settings - Fork 2
/
calculator.py
42 lines (28 loc) · 942 Bytes
/
calculator.py
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
import math
class Calculator:
def __init__(self):
self.last_answer = None # TODO - each time the calculator returns an answer, store it here
def add(self, a: float, b: float) -> float:
# TODO - add a to b and return the sum
raise NotImplementedError
def subtract(self, a, b) -> float:
# TODO - subtract a from b and return the difference
raise NotImplementedError
def multiply(self, a, b) -> float:
# TODO - multiply a by b and return the product
raise NotImplementedError
def divide(self, a, b) -> float:
# TODO - divide a by b and return the quotient
raise NotImplementedError
def repeat_last_answer(self) -> float:
# TODO - implement this method
raise NotImplementedError
class ScientificCalculator:
# TODO
pass
class BusinessCalculator:
# TODO
pass
class GraphingCalculator:
# TODO
pass