arithmetic module¶
Introduction¶
The documentation of the class Arithmetic and its members from the utils/arithmetic.py file that was automatically generated using sphinx-apidoc command.
Here are some equations with variables \(a,b\) which can be added in an .rst file as:
.. math::
c = a + b \\
d = a \div b \\
e = a \times b \\
f = a - b \\
Mathjax now renders the above math expressions as:
Arithmetic Class¶
- class arithmetic.Arithmetic(a, b)¶
Bases:
object
Arithmetic class for operations on two numbers
- __init__(a, b)¶
init function
- Parameters
a (float) – first number
b (float) – second number
Note
This function can accept
int
parameters too.Example:
object = Arithmetic(a=10,b=2)
- add()¶
this method adds the two numbers of the class
- Returns
sum of the two attributes of the class
- Return type
float
Example:
result = Arithmetic.add()
- divide()¶
this method divides the first number by second number
- Returns
quotient of the division of the two attributes of the class
- Return type
float
Warning
b=0
will causeZeroDivisionError
exception!Example:
result = Arithmetic.divide()
- multiply()¶
this method multiplies the two numbers of the class
- Returns
product of the two attributes of the class
- Return type
float
Example:
result = Arithmetic.multiply()
- subtract()¶
this method subtracts the two numbers of the class
- Returns
difference of the second number from first number
- Return type
float
Example:
result = Arithmetic.subtract()
Attention¶
The following methods can be used to call attention to text.
Warning
You have been warned!
See also
Some external/internal links.
Version information can be added using:
.. versionadded:: 0.0.1
.. versionchanged:: 0.0.1
These print the following:
New in version 0.0.1.
Changed in version 0.0.1.
Tables¶
Here is the code to add a table:
+------------+------------+-----------+
| Column 1 | Column 2 | Column 3 |
+============+============+===========+
| A1 | A2 | A3 |
+------------+------------+-----------+
| B1 | B2 | B3 |
+------------+------------+-----------+
It produces the following table:
Column 1 |
Column 2 |
Column 3 |
---|---|---|
A1 |
A2 |
A3 |
B1 |
B2 |
B3 |