Calculator#

class src.calc_numbers.calculator.Calculator[source]#

Bases: object

A simple calculator class for basic arithmetic operations.

Notes

hello this is notes

value#

The current value stored in the calculator.

Type:

int

Methods

add

Add two numbers to the calculator's current value or add a single number to the current value.

minus

Subtract two numbers from the calculator's current value or subtract a single number from the current value.

add(a, b=None)[source]#

Add two numbers to the calculator’s current value or add a single number to the current value.

Parameters:
  • a (int) – The first number to add.

  • b (int, optional) – The second number to add. If not provided, ‘a’ will be added to the current value.

Returns:

a + b or value + a depends on the input

Return type:

(int)

minus(a, b=None)[source]#

Subtract two numbers from the calculator’s current value or subtract a single number from the current value.

Parameters:
  • a (int) – The first number to subtract.

  • b (int, optional) – The second number to subtract. If not provided, ‘a’ will be subtracted from the current value.

Returns:

a - b or value - a depends on the input

Return type:

(int)