Calculator
- class calculator.Calculator[source]
Bases:
objectThe main Calculator class, which provides the arithmetic operations.
Methods Summary
add(a, b)Functions adds two numbers
divide(a, b)Functions divdes one number by another
multiply(a, b)Functions multiplies two numbers
subtract(a, b)Functions subtracts one number from another
Methods Documentation
- add(a, b)[source]
- Functions adds two numbers
c = a + b
- Parameters:
a (number) – First addend
b (number) – Second addend
- Returns:
c – Sum of inputs
- Return type:
number
- divide(a, b)[source]
- Functions divdes one number by another
c = a / b
- Parameters:
a (number) – Dividend
b (number) – Divisor, must not be zero
- Returns:
c – Ratio of inputs
- Return type:
number