-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculation.py
109 lines (83 loc) · 2.58 KB
/
calculation.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
'''
Calculator program... Description and what this program does.
Author: Syed Saif
Created at: 21-Dec-2021
Last Modified at: 23-Dec-2021
Last Modified by: xxx
'''
class Calculation:
'''Calculation class performs the operations like (addition, subtraction, multiplication, division,
modulo, exponential, floor division)
'''
def __init__(self):
pass
@staticmethod
def addition(a, b):
'''Performs addition of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of addition of 2 numbers
'''
return a + b
@staticmethod
def subtraction(a, b):
return a - b
'''Performs subtraction of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of subtraction of 2 numbers
'''
@staticmethod
def multiplication(a, b):
return a * b
'''Performs multiplication of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of multiplication of 2 numbers
'''
@staticmethod
def division(a, b):
return a / b
'''Performs division of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of division of 2 numbers
'''
@staticmethod
def modulo(a, b):
return a % b
'''Performs modulo of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of modulo of 2 numbers
'''
@staticmethod
def exponential(a, b):
return a ** b
'''Performs addition of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of addition of 2 numbers
'''
@staticmethod
def floor_division(a, b):
return a // b
'''Performs floor division of 2 numbers
Args:
a (numerical): first number (int or float)
b (numerical): second number (int or float)
Returns:
numerical: result of floor division of 2 numbers
'''