A simple calculator class to perform basic arithmetic operations.
◆ __init__()
| def test.Calculator.__init__ |
( |
|
self, |
|
|
|
value = 0 |
|
) |
| |
Initializes the calculator with a starting value.
:param value: The starting value of the calculator (default is 0).
◆ add()
| def test.Calculator.add |
( |
|
self, |
|
|
|
number |
|
) |
| |
Adds a number to the current value.
:param number: The number to add.
:return: The updated value after addition.
◆ clear()
| def test.Calculator.clear |
( |
|
self | ) |
|
Resets the calculator to its initial value (0).
:return: The reset value (0).
◆ divide()
| def test.Calculator.divide |
( |
|
self, |
|
|
|
number |
|
) |
| |
Divides the current value by the given number.
:param number: The number to divide by.
:return: The updated value after division.
:raises ZeroDivisionError: If the number is zero.
◆ multiply()
| def test.Calculator.multiply |
( |
|
self, |
|
|
|
number |
|
) |
| |
Multiplies the current value by a given number.
:param number: The number to multiply with.
:return: The updated value after multiplication.
◆ subtract()
| def test.Calculator.subtract |
( |
|
self, |
|
|
|
number |
|
) |
| |
Subtracts a number from the current value.
:param number: The number to subtract.
:return: The updated value after subtraction.
The documentation for this class was generated from the following file: