calculator module

This module provides basic calculator functions:

  • Addition

  • Subtraction

  • Multiplication

  • Division

calculator.divide(x, y)[source]

Calculate the quotient of two numbers.

Parameters:
  • x (int or float) – the dividend

  • y (int or float) – the divisor

Returns:

the quotient of x and y

Return type:

int or float

Raises:

ZeroDivisionError – error when the divisor is 0

calculator.multiply(x, y)[source]

Calculate the product of two numbers.

Parameters:
  • x (int or float) – the multiplicand

  • y (int or float) – the multiplier

Returns:

the product of x and y

Return type:

int or float

calculator.subtract(x, y)[source]

Calculate the subtraction of y from x.

Parameters:
  • x (int or float) – the minuend

  • y (int or float) – the subtraend

Returns:

the difference between x and y

Return type:

int or float

calculator.sum(x, y)[source]

Calculate the sum of two numbers.

Parameters:
  • x (int or float) – the first number

  • y (int or float) – the second number

Returns:

the sum of x and y

Return type:

int or float