From ecfaf076b7b24b27004356a06a581d1cf7aa619a Mon Sep 17 00:00:00 2001 From: Christopher Fremond Date: Thu, 3 Oct 2019 07:35:42 +0100 Subject: [PATCH] update of range subjects en and fr --- subjects/range.en.md | 14 ++++++++------ subjects/range.fr.md | 32 +++++++++++++++++++------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/subjects/range.en.md b/subjects/range.en.md index dcf5ab1b8..116525ef5 100644 --- a/subjects/range.en.md +++ b/subjects/range.en.md @@ -2,17 +2,17 @@ ### Instructions -Write the program which must: +Write a program which must: - **Allocate (with make())** an array of integers. -- Fill it with consecutive values that begin at the first argument and end at the second argument (Including first and second !). +- Fill it with consecutive values that begins at the first argument and end at the second argument (Including the values of thoses arguments !). - That prints the array. -- In case of error you should handle it. +Errors should be handled. -- And if the number of arguments is bigget or lower than 2 it should print `\n`. +If the number of arguments is different from 2 the program prints a newline ("`\n`"). ### Expected output : @@ -20,9 +20,11 @@ Write the program which must: student@ubuntu:~/range$ go build student@ubuntu:~/range$ ./range 1 3 [1 2 3] -student@ubuntu:~/range$ ./range -1 2 -[-1 0 1 2] +student@ubuntu:~/range$ ./range -1 2 | cat -e +[-1 0 1 2]$ student@ubuntu:~/range$ ./range 0 0 [0] +student@ubuntu:~/reverserange$ ./reverserange 0 nan | cat -e +strconv.Atoi: parsing "nan": invalid syntax$ student@ubuntu:~/range$ ``` diff --git a/subjects/range.fr.md b/subjects/range.fr.md index 3dccdc993..bf219d81c 100644 --- a/subjects/range.fr.md +++ b/subjects/range.fr.md @@ -2,23 +2,29 @@ ### Instructions -Écrire la fonction `Range` qui doit: +Écrire un programme qui doit: -- allouer (avec make()) une slice d'entiers. -- le remplir avec des valeurs consécutives qui commencent à `start` et qui finissent à `end` (En incluant `start` et `end` !) -- et qui retourne cette slice. +- Allouer (avec make()) une slice d'entiers. -### Fonction attendue +- Le remplir avec des valeurs consécutives qui commencent au premier argument et qui finissent au deuxième (En incluant les valeurs des deux arguments !) -```go -func Range(start, end int) []int { +- Et qui affiche cette slice. -} -``` +Les erreurs doivent être gérées. + +Si le nombre d'arguments est différent de 2 le programme affiche un newline ("`\n`"). ### Utilisation -- Avec (1, 3) la fonction devra retourner une slice contenant 1, 2 et 3. -- Avec (-1, 2) la fonction devra retourner une slice contenant -1, 0, 1 et 2. -- Avec (0, 0) la fonction devra retourner une slice contenant 0. -- Avec (0, -3) la fonction devra retourner une slice contenant 0, -1, -2 et -3. +```console +student@ubuntu:~/range$ go build +student@ubuntu:~/range$ ./range 1 3 +[1 2 3] +student@ubuntu:~/range$ ./range -1 2 | cat -e +[-1 0 1 2]$ +student@ubuntu:~/range$ ./range 0 0 +[0] +student@ubuntu:~/reverserange$ ./reverserange 0 nan | cat -e +strconv.Atoi: parsing "nan": invalid syntax$ +student@ubuntu:~/range$ +```