From 406199a66ea942a40c4a58acf23bc8e38e26f084 Mon Sep 17 00:00:00 2001 From: Michele Sessa Date: Wed, 1 Feb 2023 15:46:42 +0000 Subject: [PATCH] feat(candidates_checker): add new py exercise to scripting piscine --- subjects/devops/candidates_checker/README.md | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 subjects/devops/candidates_checker/README.md diff --git a/subjects/devops/candidates_checker/README.md b/subjects/devops/candidates_checker/README.md new file mode 100644 index 00000000..a729360c --- /dev/null +++ b/subjects/devops/candidates_checker/README.md @@ -0,0 +1,47 @@ +## Candidates checker + +### Instructions + +Create a file `candidates_checker.py` which will receive the number of candidates as the only argument. + +This argument will always be convertible to `int`, the script will then ask for each candidate the name as string and the age as number. + +Once the information for each candidate is retrieved for each of them the script will check the age and print one of the following results: +- `"[name] is not eligible (underaged)"` when the age is less than 18. +- `"[name] is not eligible (over the legal age)"` when the age is more than 60. +- `"[name] is eligible"` when the age is between 18 and 60 (included). + +> You must use dictionaries to save the data about the candidates. + +### Usage + +Here is an example of your script running: + +```console +$ python3 candidates_checker.py 3 +Add a new candidate: +name: Edoardo +age: 17 +Add a new candidate: +name: Michele +age: 60 +Add a new candidate: +name: Lea +age: 61 +Edoardo is not eligible (underaged) +Michele is eligible +Lea is not eligible (over the legal age) +$ +``` + +### Hints + +- In order to succeed your script should print **exactly** the same output as the one in the usage section. So `Add a new candidate`, `name: ` and `age: ` should be written in the exact same way and order. + +- Tough it is not mandatory you could use `if __name__ == '__main__':` to specify the entrypoint of your script. + +### References + +- [Function strip()](https://docs.python.org/3.11/library/stdtypes.html?highlight=strip#str.strip) +- [String multiplication](https://www.geeksforgeeks.org/create-multiple-copies-of-a-string-in-python-by-using-multiplication-operator/) +- [Entrypoint for a Python script](https://realpython.com/if-name-main-python/) \ No newline at end of file