  @webbdevvue/

# importing_modules_exer ## No description

Files
• main.py
main.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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
```
```from addition import Addition

class Calculator:
@classmethod

@classmethod
def subtract(cls, num1, num2):

@classmethod
def multiply(cls, num1, num2):
res = 0
for x in range(0, num2):
return res

@classmethod
def divide(cls, num1, num2):
res = 0
while num1 >= num2:
num1 = cls.subtract(num1, num2)  # subtract num2 from num1 until its remainder is smaller than num2
res = cls.add(res, 1)   # count the times of subtraction as the result
return res

'''
=====>>
MY ATTEMPT THAT WORKS BUT NOT BY THE RULES
<<=====
# You don't need to change the import statement
# the Addition.add() function takes in two parameters `num1` and `num2` and return the sum of `num1` and `num2`

# Please create and implement a Calculator class, which makes use of the `addition` module.
# Your Calculator should achieve these goals:
# - It cannot use addition, subtraction, multiplication and division operators (`+`, `-`, `*` and `/`) directly.
# - To simplify the problem, you may expect input for the multiply() and divide() methods are all non-integers,
#   and will always be valid, i.e. all non-negative integers and no 0 as divisor.

# the class definition and a sample class method `Addition.add()` is provided below
class Calculator:

# a sample add() method in our calculator is shown below
# you may learn from it and implement the other methods
@classmethod

# implement a class method `subtract()` that takes in num1 and num2 and return num1 - num2
# your `subtract()` method cannot use the + - * / calculation operators, but can use - as a negative sign operator
@classmethod
def subtract(cls, num1, num2):

# implement a class method `multiply()` that takes in num1 and num2 and return num1 * num2
# your `multiply()` method cannot use the + - * / calculation operators, but can use - as a negative sign operator
# you may assume num1 and num2 are always non-negative integers
@classmethod
def multiply(cls, num1, num2):
res = 0
for i in range(0, num2):
res = res + num1
return res

# implement a class method `divide()` that takes in num1 and num2 and return num1 // num2
# your `divide()` method cannot use the + - * / calculation operators, but can use - as a negative sign operator
# you may assume num1 is always a non-negative integer, and num2 is always a positive integer
@classmethod
def divide(cls, num1, num2):
quot = 0
while num1 >= num2:
num1 = num1 - num2
quot+=1
return quot