MCPcopy Create free account
hub / github.com/geekcomputers/Python / Calculator

Class Calculator

advanced_calculator.py:30–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29# Validation checker
30class Calculator:
31 def __init__(self):
32 self.take_inputs()
33
34 def add(self):
35 """summary: Get the sum of numbers
36
37 Returns:
38 _type_: _description_
39 """
40 return self.num1 + self.num2
41
42 def sub(self):
43 """_summary_: Get the difference of numbers
44
45 Returns:
46 _type_: _description_
47 """
48 return self.num1 - self.num2
49
50 def multi(self):
51 """_summary_: Get the product of numbers
52
53 Returns:
54 _type_: _description_
55 """
56 return self.num1 * self.num2
57
58 def div(self):
59 """_summary_: Get the quotient of numbers
60
61 Returns:
62 _type_: _description_
63 """
64 # What do we mean by quotient?
65 return self.num1 / self.num2
66
67 def power(self):
68 """_summary_: Get the power of numbers
69
70 Returns:
71 _type_: _description_
72 """
73 return self.num1**self.num2
74
75 def root(self):
76 """_summary_: Get the root of numbers
77
78 Returns:
79 _type_: _description_
80 """
81 return self.num1 ** (1 / self.num2)
82
83 def remainer(self):
84 """_summary_: Get the remainder of numbers
85
86 Returns:
87 _type_: _description_

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected