Skip to content

Reference

This part of the project documentation focuses on an information-oriented approach. Use it as a reference for the technical implementation of the project project code.

Provide several sample math calculations. a delta

This module allows the user to make mathematical calculations.

Examples:

>>> from project import proj
>>> proj.add(2, 4)
6.0
>>> proj.multiply(2.0, 4.0)
8.0
>>> from project.proj import divide
>>> divide(4.0, 2)
2.0

The module contains the following functions:

  • add(a, b) - Returns the sum of two numbers.
  • subtract(a, b) - Returns the difference of two numbers.
  • multiply(a, b) - Returns the product of two numbers.
  • divide(a, b) - Returns the quotient of two numbers.

add(a, b)

Compute and return the sum of two numbers.

Examples:

>>> add(4.0, 2.0)
6.0
>>> add(4, 2)
6.0

Parameters:

Name Type Description Default
a float

A number representing the first addend in the addition.

required
b float

A number representing the second addend in the addition.

required

Returns:

Name Type Description
float float

A number representing the arithmetic sum of a and b.

Source code in project/proj.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
def add(a: Union[float, int], b: Union[float, int]) -> float:
    """Compute and return the sum of two numbers.

    Examples:
        >>> add(4.0, 2.0)
        6.0
        >>> add(4, 2)
        6.0

    Args:
        a (float): A number representing the first addend in the addition.
        b (float): A number representing the second addend in the addition.

    Returns:
        float: A number representing the arithmetic sum of `a` and `b`.
    """
    return float(a + b)