From cdd1f395b78b640d0047d95ec7b5acd29861ffce Mon Sep 17 00:00:00 2001 From: Michele Sessa Date: Thu, 2 Feb 2023 10:31:42 +0000 Subject: [PATCH] docs(candidates_checker): add requirement to check number of arguments --- subjects/devops/candidates_checker/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/subjects/devops/candidates_checker/README.md b/subjects/devops/candidates_checker/README.md index a729360c..c716c942 100644 --- a/subjects/devops/candidates_checker/README.md +++ b/subjects/devops/candidates_checker/README.md @@ -3,10 +3,12 @@ ### Instructions Create a file `candidates_checker.py` which will receive the number of candidates as the only argument. +If a wrong number of arguments is passed the script will print `Error: wrong number of arguments` and exit with `1`. -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. +When provided, the 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). @@ -34,6 +36,13 @@ Lea is not eligible (over the legal age) $ ``` +Here an example of bad usage: +```console +$ python3 candidates_checker.py +Error: wrong number of arguments +$ +``` + ### 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. @@ -44,4 +53,4 @@ $ - [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 +- [Entrypoint for a Python script](https://realpython.com/if-name-main-python/)