1
0

Compare commits

...

4 Commits

Author SHA1 Message Date
Arnaud Morin
3a092646b9
Merge pull request #1 from arnaudmorin/python_exercise
Added some more python exercises
2023-10-11 17:27:03 +02:00
Charles Vaillancourt
5399aaeb8f Added some more python exercises 2023-10-11 10:44:08 -04:00
5a76be525c Switch from plik to app
plik was not statically compile and may not work on some systems

Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
2023-10-11 16:41:58 +02:00
Florent Le Lain
2b3666c0c0 add plik binary 2023-10-06 18:18:33 +02:00
2 changed files with 46 additions and 6 deletions

View File

@ -12,10 +12,52 @@ Fork this repo to your own github repo
# Ex. 1 - python # Ex. 1 - python
Here is the output of a python application: This exercise will be split into multiple smaller ones. For each one
you can create files named `a.py`, `b.py` and `c.py`. You maybe resuse the same
environment for all sub-exercises
Guidelines:
- Use python version python3.7+.
- Unless specified otherwise you can only use builtin modules.
### python - A
Write a script that prints out whatever text input is passed as argument
Example:
```
$ python a.py ping ping ping
ping ping ping
```
### python - B
Write a script take takes one argument (-t/--target) which can only
accept the following values `titi`, `toto`, `tata`. When called with a valid
target, the script should print out the target text to stdout (`titi`, `toto` or `tata`).
When an invalid target is provided an error message should be printed to stderr
Example:
```
$ python b.py --target titi
titi
$ python b.py -t tutu
usage: b.py [-h] [-t {titi,toto,tata}]
b.py: error: argument -t/--target: invalid choice: 'tutu' (choose from 'titi', 'toto', 'tata')
```
### python - C
Write a script that creates ascii art equivalent of text passed as argument.
For this exercise you may use a 3rd party module.
Example:
```bash ```bash
$ python run.py 'Hello buddies' $ python c.py 'Hello buddies'
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
| | | | ___ | || | ___ | |__ _ _ __| | __| |(_) ___ ___ | | | | ___ | || | ___ | |__ _ _ __| | __| |(_) ___ ___
| |_| | / _ \| || | / _ \ | '_ \ | | | | / _` | / _` || | / _ \/ __| | |_| | / _ \| || | / _ \ | '_ \ | | | | / _` | / _` || | / _ \/ __|
@ -24,13 +66,11 @@ $ python run.py 'Hello buddies'
``` ```
Can you write the run.py application and put it in the ex1 folder of the repo?
# Ex. 2 - docker # Ex. 2 - docker
In ex2 folder, you will find a `plik` binary (taken from https://plik.ovh). In ex2 folder, you will find a `app` binary.
Can you build very lighweight docker image that contains ONLY `plik` binary, and that execute `plik` by default? Can you build very lighweight docker image that contains ONLY `app` binary, and that execute `app` by default?
Push your Dockerfile in the ex2 folder. Push your Dockerfile in the ex2 folder.

BIN
ex2/app Executable file

Binary file not shown.