calculator module¶
- class calculator.Calculator(name)[source]¶
Bases:
object
A simple calculator class that performs basic arithmetic operations.
- name¶
The name of the calculator.
- Type:
str
- add(num1, num2)[source]¶
Adds two numbers.
- Parameters:
num1 (int or float) – The first number.
num2 (int or float) – The second number.
- Returns:
The sum of the two numbers.
- Return type:
int or float
- divide(num1, num2)[source]¶
Divides two numbers.
- Parameters:
num1 (int or float) – The dividend.
num2 (int or float) – The divisor.
- Returns:
The quotient of the two numbers.
- Return type:
int or float