Browse Source

docs(numerical_operations): change position of optional section

pull/1764/head
Michele Sessa 2 years ago committed by Michele
parent
commit
c4ea506acf
  1. 48
      subjects/devops/numerical_operations/README.md

48
subjects/devops/numerical_operations/README.md

@ -12,6 +12,30 @@ Create a file `numerical_operations.py` containing the following functions:
We assume that `a` and `b` are numbers (`int` or `float`). We assume that `a` and `b` are numbers (`int` or `float`).
### Usage
Here is a possible `test.py` to test your functions:
```python
import numerical_operations
print(numerical_operations.add(2, 2))
print(numerical_operations.subtract(10, 5))
print(numerical_operations.multiply(3, 4))
print(numerical_operations.power(3, 3))
print(numerical_operations.square(3))
```
```bash
$ python test.py
4
5
12
27
9
$
```
### [Optional] Use a virtual environnement to run python code locally ### [Optional] Use a virtual environnement to run python code locally
Virtual environments can help you to run your code locally. Virtual environments can help you to run your code locally.
@ -38,30 +62,6 @@ Python 3.10.4
> We advise you to create one virtual environment per python project. Later, we could also install external packages on our environment. > We advise you to create one virtual environment per python project. Later, we could also install external packages on our environment.
### Usage
Here is a possible `test.py` to test your functions:
```python
import numerical_operations
print(numerical_operations.add(2, 2))
print(numerical_operations.subtract(10, 5))
print(numerical_operations.multiply(3, 4))
print(numerical_operations.power(3, 3))
print(numerical_operations.square(3))
```
```bash
$ python test.py
4
5
12
27
9
$
```
### Hints ### Hints
- You could `import math` at the start of your file to use the functions defined in that library (for example `math.sqrt()`). - You could `import math` at the start of your file to use the functions defined in that library (for example `math.sqrt()`).

Loading…
Cancel
Save