Browse Source

move previous subjects

content-update
Clement Denis 5 years ago committed by Clément
parent
commit
bc723d6db2
  1. 4
      subjects/abort.md
  2. 4
      subjects/activebits.md
  3. 42
      subjects/advancedsortwordarr.en.md
  4. 42
      subjects/advancedsortwordarr.fr.md
  5. 1
      subjects/advancedsortwordtab.en.md
  6. 48
      subjects/any.en.md
  7. 48
      subjects/any.fr.md
  8. 48
      subjects/appendrange.en.md
  9. 47
      subjects/appendrange.fr.md
  10. 77
      subjects/atoi.en.md
  11. 77
      subjects/atoi.fr.md
  12. 59
      subjects/atoibase.en.md
  13. 59
      subjects/atoibase.fr.md
  14. 57
      subjects/basicatoi.en.md
  15. 57
      subjects/basicatoi.fr.md
  16. 62
      subjects/basicatoi2.en.md
  17. 62
      subjects/basicatoi2.fr.md
  18. 40
      subjects/basicjoin.en.md
  19. 40
      subjects/basicjoin.fr.md
  20. 4
      subjects/btreeapplybylevel.md
  21. 48
      subjects/btreeapplyinorder.en.md
  22. 47
      subjects/btreeapplypostorder.en.md
  23. 47
      subjects/btreeapplypreorder.en.md
  24. 4
      subjects/btreedeletenode.md
  25. 52
      subjects/btreeinsertdata.en.md
  26. 4
      subjects/btreeisbinary.md
  27. 4
      subjects/btreemax.md
  28. 48
      subjects/btreeprintroot.en.md
  29. 74
      subjects/btreesearchitem.en.md
  30. 41
      subjects/capitalize.en.md
  31. 41
      subjects/capitalize.fr.md
  32. 21
      subjects/cl-camp1.en.md
  33. 21
      subjects/cl-camp1.fr.md
  34. 17
      subjects/cl-camp2.en.md
  35. 17
      subjects/cl-camp2.fr.md
  36. 15
      subjects/cl-camp3.en.md
  37. 15
      subjects/cl-camp3.fr.md
  38. 24
      subjects/cl-camp4.en.md
  39. 24
      subjects/cl-camp4.fr.md
  40. 26
      subjects/cl-camp5.en.md
  41. 26
      subjects/cl-camp5.fr.md
  42. 15
      subjects/cl-camp6.en.md
  43. 15
      subjects/cl-camp6.fr.md
  44. 15
      subjects/cl-camp7.en.md
  45. 15
      subjects/cl-camp7.fr.md
  46. 11
      subjects/cl-camp8.en.md
  47. 11
      subjects/cl-camp8.fr.md
  48. 21
      subjects/cl.en.md
  49. 114
      subjects/commandments.en.md
  50. 43
      subjects/compare.en.md
  51. 43
      subjects/compare.fr.md
  52. 40
      subjects/concat.en.md
  53. 40
      subjects/concat.fr.md
  54. 44
      subjects/concatparams.en.md
  55. 44
      subjects/concatparams.fr.md
  56. 43
      subjects/convertbase.en.md
  57. 43
      subjects/convertbase.fr.md
  58. 44
      subjects/countif.en.md
  59. 44
      subjects/countif.fr.md
  60. 50
      subjects/divmod.en.md
  61. 50
      subjects/divmod.fr.md
  62. 39
      subjects/doop.en.md
  63. 39
      subjects/doop.fr.md
  64. 33
      subjects/eightqueens.en.md
  65. 33
      subjects/eightqueens.fr.md
  66. 50
      subjects/fibonacci.en.md
  67. 51
      subjects/fibonacci.fr.md
  68. 41
      subjects/findnextprime.en.md
  69. 43
      subjects/findnextprime.fr.md
  70. 1
      subjects/firebase-demo.en.md
  71. 42
      subjects/firstrune.en.md
  72. 42
      subjects/firstrune.fr.md
  73. 36
      subjects/foreach.en.md
  74. 36
      subjects/foreach.fr.md
  75. 3
      subjects/functions.en.md
  76. 7
      subjects/get-ready.en.md
  77. 20
      subjects/go-say-hello.en.md
  78. 15
      subjects/go-say-hello.fr.md
  79. 43
      subjects/index.en.md
  80. 43
      subjects/index.fr.md
  81. 46
      subjects/isalpha.en.md
  82. 46
      subjects/isalpha.fr.md
  83. 42
      subjects/islower.en.md
  84. 42
      subjects/islower.fr.md
  85. 40
      subjects/isnegative.en.md
  86. 40
      subjects/isnegative.fr.md
  87. 41
      subjects/isnumeric.en.md
  88. 42
      subjects/isnumeric.fr.md
  89. 41
      subjects/isprime.en.md
  90. 41
      subjects/isprime.fr.md
  91. 43
      subjects/isprintable.en.md
  92. 43
      subjects/isprintable.fr.md
  93. 51
      subjects/issorted.en.md
  94. 50
      subjects/issorted.fr.md
  95. 42
      subjects/isupper.en.md
  96. 42
      subjects/isupper.fr.md
  97. 42
      subjects/iterativefactorial.en.md
  98. 42
      subjects/iterativefactorial.fr.md
  99. 44
      subjects/iterativepower.en.md
  100. 44
      subjects/iterativepower.fr.md
  101. Some files were not shown because too many files changed in this diff diff.show_more

4
subjects/abort.md

@ -10,7 +10,7 @@ This function must have the following signature.
```go
func Abort(a, b, c, d, e int) int {
}
```
@ -38,5 +38,5 @@ And its output :
student@ubuntu:~/student/abort$ go build
student@ubuntu:~/student/abort$ ./abort
5
student@ubuntu:~/student/abort$
student@ubuntu:~/student/abort$
```

4
subjects/activebits.md

@ -9,7 +9,7 @@ The function must have the next signature.
### Expected function
```go
func ActiveBits(n int) uint {
func ActiveBits(n int) uint {
}
```
@ -38,5 +38,5 @@ And its output :
student@ubuntu:~/student/activebits$ go build
student@ubuntu:~/student/activebits$ ./activebits
10
student@ubuntu:~/student/activebits$
student@ubuntu:~/student/activebits$
```

42
subjects/advancedsortwordarr.en.md

@ -0,0 +1,42 @@
# advancedsortwordarr
## Instructions
Write a function `AdvancedSortWordArr` that sorts a `string` array, based on the function `f` passed in parameter.
## Expected function
```go
func AdvancedSortWordTab(array []string, f func(a, b string) int) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
result := []string{"a", "A", "1", "b", "B", "2", "c", "C", "3"}
piscine.AdvancedSortWordTab(result, piscine.Compare)
fmt.Println(result)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
[1 2 3 A B C a b c]
student@ubuntu:~/piscine/test$
```

42
subjects/advancedsortwordarr.fr.md

@ -0,0 +1,42 @@
# advancedsortwordarr
## Instructions
Écrire une fonction `AdvancedSortWordArr` qui trie un tableau de `string`, basé sur la fonction `f` passée en paramètre.
## Fonction attendue
```go
func AdvancedSortWordTab(array []string, f func(a, b string) int) {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
result := []string{"a", "A", "1", "b", "B", "2", "c", "C", "3"}
piscine.AdvancedSortWordTab(result, piscine.Compare)
fmt.Println(result)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
[1 2 3 A B C a b c]
student@ubuntu:~/piscine/test$
```

1
subjects/advancedsortwordtab.en.md

@ -0,0 +1 @@
# advancedsortwordtab

48
subjects/any.en.md

@ -0,0 +1,48 @@
# any
## Instructions
Write a function `Any` that returns `true`, for a `string` array:
- if, when that `string` array is passed through an `f` function, at least one element returns `true`.
## Expected function
```go
func Any(f func(string) bool, arr []string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []string{"Hello", "how", "are", "you"}
tab2 := []string{"This", "is", "4", "you"}
result1 := piscine.Any(piscine.IsNumeric, tab1)
result2 := piscine.Any(piscine.IsNumeric, tab2)
fmt.Println(result1)
fmt.Println(result2)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
false
true
student@ubuntu:~/piscine/test$
```

48
subjects/any.fr.md

@ -0,0 +1,48 @@
# any
## Instructions
Écrire une fonction `Any` qui retournes `true`, pour un tableau de `string`:
- si, lorsque ce tableau de `string` est passé à travers une fonction `f`, au moins un element retournes `true`.
## Fonction attendue
```go
func Any(f func(string) bool, arr []string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []string{"Hello", "how", "are", "you"}
tab2 := []string{"This", "is", "4", "you"}
result1 := piscine.Any(piscine.IsNumeric, tab1)
result2 := piscine.Any(piscine.IsNumeric, tab2)
fmt.Println(result1)
fmt.Println(result2)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
false
true
student@ubuntu:~/piscine/test$
```

48
subjects/appendrange.en.md

@ -0,0 +1,48 @@
# appendrange
## Instructions
Write a function that takes an `int` min and an `int` max as parameters.
That function returns a slice of `int` with all the values between min and max.
Min is included, and max is excluded.
If min is superior or equal to max, a `nil` slice is returned.
`make` is not allowed for this exercise.
## Expected function
```go
func AppendRange(min, max int) []int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.AppendRange(5, 10))
fmt.Println(piscine.AppendRange(10, 5))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
[5 6 7 8 9]
[]
student@ubuntu:~/piscine/test$
```

47
subjects/appendrange.fr.md

@ -0,0 +1,47 @@
# appendrange
## Instructions
Écrire une fonction qui prend un `int` minimum et un `int` maximum comme paramètres. Cette fonction retournes une slice d'`int` avec toutes les valeurs comprises entre le minimum et le maximum.
Le minimum est inclus, le maximum est exclu.
Si le minimum est supérieur ou égal au maximum, une slice `nil` est retournée.
`make` n'est pas autorisé pour cet exercice.
## Fonction attendue
```go
func AppendRange(min, max int) []int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.AppendRange(5, 10))
fmt.Println(piscine.AppendRange(10, 5))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
[5 6 7 8 9]
[]
student@ubuntu:~/piscine/test$
```

77
subjects/atoi.en.md

@ -0,0 +1,77 @@
# atoi
## Instructions
- Write a [function](TODO-LINK) that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number represented as a `string` in a number represented as an `int`.
- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters.
- For this exercise the handling of the signs + or - **does have** to be taken into account.
- This function will **only** have to return the `int` `nbr`. For this exercise the `error` return of atoi is not required.
## Format required
```go
func Atoi(s string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "012 345"
s4 := "Hello World!"
s5 := "+1234"
s6 := "-1234"
s7 := "++1234"
s8 := "--1234"
n := piscine.Atoi(s)
n2 := piscine.Atoi(s2)
n3 := piscine.Atoi(s3)
n4 := piscine.Atoi(s4)
n5 := piscine.Atoi(s5)
n6 := piscine.Atoi(s6)
n7 := piscine.Atoi(s7)
n8 := piscine.Atoi(s8)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
fmt.Println(n5)
fmt.Println(n6)
fmt.Println(n7)
fmt.Println(n8)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
0
1234
-1234
0
0
student@ubuntu:~/piscine/test$
```

77
subjects/atoi.fr.md

@ -0,0 +1,77 @@
# atoi
## Instructions
- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier).
- Atoi retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres charactères que des chiffres.
- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte.
- Cette fonction aura **seulement** à retourner l'`int` (entier) `nbr`. Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé.
## Fonction attendue
```go
func Atoi(s string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "012 345"
s4 := "Hello World!"
s5 := "+1234"
s6 := "-1234"
s7 := "++1234"
s8 := "--1234"
n := piscine.Atoi(s)
n2 := piscine.Atoi(s2)
n3 := piscine.Atoi(s3)
n4 := piscine.Atoi(s4)
n5 := piscine.Atoi(s5)
n6 := piscine.Atoi(s6)
n7 := piscine.Atoi(s7)
n8 := piscine.Atoi(s8)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
fmt.Println(n5)
fmt.Println(n6)
fmt.Println(n7)
fmt.Println(n8)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
0
1234
-1234
0
0
student@ubuntu:~/piscine/test$
```

59
subjects/atoibase.en.md

@ -0,0 +1,59 @@
# atoibase
## Instructions
Write a function that takes a `string` number and its `string` base in parameters and returns its conversion as an `int`.
If the base or the `string` number is not valid it returns `0`:
Validity rules for a base :
- A base must contain at least 2 characters.
- Each character of a base must be unique.
- A base should not contain `+` or `-` characters.
Only valid `string` numbers will be tested.
The function **does not have** to manage negative numbers.
## Expected function
```go
func AtoiBase(s string, base string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.AtoiBase("125", "0123456789"))
fmt.Println(piscine.AtoiBase("1111101", "01"))
fmt.Println(piscine.AtoiBase("7D", "0123456789ABCDEF"))
fmt.Println(piscine.AtoiBase("uoi", "choumi"))
fmt.Println(piscine.AtoiBase("bbbbbab", "-ab")
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
125
125
125
125
0
student@ubuntu:~/piscine/test$
```

59
subjects/atoibase.fr.md

@ -0,0 +1,59 @@
# atoibase
## Instructions
Écrire une fonction qui prend un nombre `string` et sa base `string` en paramètres et retournes sa convertion en `int`.
Si la base n'est pas valide elle retournes `0`:
Régles de validité d'une base :
- Une base doit contenir au moins 2 charactères.
- Chaque charactère d'une base doit être unique.
- Une base ne doit pas contenir les charactères `+` ou `-`.
Seuls des nombres en `string` valides seront testés.
La fonction **ne doit pas** gérer les nombres négatifs.
## Fonction attendue
```go
func AtoiBase(s string, base string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.AtoiBase("125", "0123456789"))
fmt.Println(piscine.AtoiBase("1111101", "01"))
fmt.Println(piscine.AtoiBase("7D", "0123456789ABCDEF"))
fmt.Println(piscine.AtoiBase("uoi", "choumi"))
fmt.Println(piscine.AtoiBase("bbbbbab", "-ab")
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
125
125
125
125
0
student@ubuntu:~/piscine/test$
```

57
subjects/basicatoi.en.md

@ -0,0 +1,57 @@
# basicatoi
## Instructions
- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`.
- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **only valid** `string` chains will be tested. They will only contain one or several digits as characters.
- For this exercise the handling of the signs + or - does not have to be taken into account.
- This function will **only** have to return the `int` `nbr`. For this exercise the `error` return of atoi is not required.
## Expected function
```go
func BasicAtoi(s string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "000000"
n := piscine.BasicAtoi(s)
n2 := piscine.BasicAtoi(s2)
n3 := piscine.BasicAtoi(s3)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
student@ubuntu:~/piscine/test$
```

57
subjects/basicatoi.fr.md

@ -0,0 +1,57 @@
# basicatoi
## Instructions
- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier).
- Atoi retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice **seulement des** `string` **valides** seront testé. Elles ne contiendront que un ou plusieurs chiffres comme charact.
- Pour cet exercice la gestion des signes + ou - ne doit pas être prise en compte.
- Cette fonction aura **seulement** à retourner l'`int` (entier) `nbr`. Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé.
## Fonction attendue
```go
func BasicAtoi(s string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "000000"
n := piscine.BasicAtoi(s)
n2 := piscine.BasicAtoi(s2)
n3 := piscine.BasicAtoi(s3)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
student@ubuntu:~/piscine/test$
```

62
subjects/basicatoi2.en.md

@ -0,0 +1,62 @@
# basicatoi2
## Instructions
- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`.
- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters.
- For this exercise the handling of the signs + or - does not have to be taken into account.
- This function will **only** have to return the `int` `nbr`. For this exercise the `error` return of atoi is not required.
## Expected Function
```go
func BasicAtoi2(s string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "012 345"
s4 := "Hello World!"
n := piscine.BasicAtoi2(s)
n2 := piscine.BasicAtoi2(s2)
n3 := piscine.BasicAtoi2(s3)
n4 := piscine.BasicAtoi2(s4)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
0
student@ubuntu:~/piscine/test$
```

62
subjects/basicatoi2.fr.md

@ -0,0 +1,62 @@
# basicatoi2
## Instructions
- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier).
- Atoi retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres charactères que des chiffres.
- Pour cet exercice la gestion des signes + ou - ne doit pas être prise en compte.
- Cette fonction aura **seulement** à retourner l'`int` (entier) `nbr`. Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé.
## Fonction attendue
```go
func BasicAtoi2(s string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
s := "12345"
s2 := "0000000012345"
s3 := "012 345"
s4 := "Hello World!"
n := piscine.BasicAtoi2(s)
n2 := piscine.BasicAtoi2(s2)
n3 := piscine.BasicAtoi2(s3)
n4 := piscine.BasicAtoi2(s4)
fmt.Println(n)
fmt.Println(n2)
fmt.Println(n3)
fmt.Println(n4)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
12345
12345
0
0
student@ubuntu:~/piscine/test$
```

40
subjects/basicjoin.en.md

@ -0,0 +1,40 @@
# basicjoin
## Instructions
Write a function that returns the concatenation of all the `string` of a table of `string` passed in argument.
## Expected function
```go
func basicJoin(strs []string) string {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
toConcat := []string{"Hello!", " How", " are", " you?"}
fmt.Println(piscine.BasicJoin(toConcat))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How are you?
student@ubuntu:~/piscine/test$
```

40
subjects/basicjoin.fr.md

@ -0,0 +1,40 @@
# basicjoin
## Instructions
Écrire une fonction qui retourne la concaténation de toutes les `string` d'un slice de `string` passées en paramètres.
## Fonction attendue
```go
func BasicJoin(strs []string) string {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
toConcat := []string{"Hello!", " How", " are", " you?"}
fmt.Println(piscine.BasicJoin(toConcat))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How are you?
student@ubuntu:~/piscine/test$
```

4
subjects/btreeapplybylevel.md

@ -10,7 +10,7 @@ This function must have the following signature.
```go
func BTreeApplyByLevel(root *TreeNode, fn interface{}) {
}
```
@ -44,5 +44,5 @@ student@ubuntu:~/student/btreeapplybylevel$ ./btreeapplybylevel
1
7
5
student@ubuntu:~/student/btreeapplybylevel$
student@ubuntu:~/student/btreeapplybylevel$
```

48
subjects/btreeapplyinorder.en.md

@ -0,0 +1,48 @@
# btreeinsertdata
## Instructions
Write a function that applies a function in order to each element in the tree
(see in order tree walks)
## Expected function
```go
func BTreeApplyInorder(root *piscine.TreeNode, f func(...interface{}) (int, error)) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine "."
)
func main() {
root := &piscine.TreeNode{Data: "4"}
piscine.BTreeInsertData(root, "1")
piscine.BTreeInsertData(root, "7")
piscine.BTreeInsertData(root, "5")
BTreeApplyInorder(root, fmt.Println)
}
```
And its output :
```console
student@ubuntu:~/piscine/btreeinsertdata$ go build
student@ubuntu:~/piscine/btreeinsertdata$ ./btreeinsertdata
1
4
5
7
student@ubuntu:~/piscine/btreeinsertdata$
```

47
subjects/btreeapplypostorder.en.md

@ -0,0 +1,47 @@
# btreeinsertdata
## Instructions
Write a function that applies a function using a postorder walk to each element in the tree
## Expected function
```go
func BTreeApplyPostorder(root *piscine.TreeNode, f func(...interface{}) (int, error)) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine "."
)
func main() {
root := &piscine.TreeNode{Data: "4"}
piscine.BTreeInsertData(root, "1")
piscine.BTreeInsertData(root, "7")
piscine.BTreeInsertData(root, "5")
BTreeApplyPostorder(root, fmt.Println)
}
```
And its output :
```console
student@ubuntu:~/piscine/btreeinsertdata$ go build
student@ubuntu:~/piscine/btreeinsertdata$ ./btreeinsertdata
1
5
7
4
student@ubuntu:~/piscine/btreeinsertdata$
```

47
subjects/btreeapplypreorder.en.md

@ -0,0 +1,47 @@
# btreeinsertdata
## Instructions
Write a function that applies a function using a preorder walk to each element in the tree
## Expected function
```go
func BTreeApplyPreorder(root *piscine.TreeNode, f func(...interface{}) (int, error)) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine "."
)
func main() {
root := &piscine.TreeNode{Data: "4"}
piscine.BTreeInsertData(root, "1")
piscine.BTreeInsertData(root, "7")
piscine.BTreeInsertData(root, "5")
BTreeApplyPreorder(root, fmt.Println)
}
```
And its output :
```console
student@ubuntu:~/piscine/btreeinsertdata$ go build
student@ubuntu:~/piscine/btreeinsertdata$ ./btreeinsertdata
4
1
7
5
student@ubuntu:~/piscine/btreeinsertdata$
```

4
subjects/btreedeletenode.md

@ -12,7 +12,7 @@ This function must have the following signature.
```go
func BTreeDeleteNode(root, node *TreeNode) *TreeNode {
}
```
@ -57,5 +57,5 @@ After delete:
1
5
7
student@ubuntu:~/student/btreedeletenode$
student@ubuntu:~/student/btreedeletenode$
```

52
subjects/btreeinsertdata.en.md

@ -0,0 +1,52 @@
# btreeinsertdata
## Instructions
Write a function that inserts new data in a binary search tree
following the properties of binary search trees.
The nodes must be defined as follows:
## Expected function
```go
type TreeNode struct {
Left, Right, Parent *TreeNode
Data string
}
func BTreeInsertData(root *TreeNode, data string) *TreeNode {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
func main() {
root := &TreeNode{data: "4"}
BTreeInsertData(root, "1")
BTreeInsertData(root, "7")
BTreeInsertData(root, "5")
fmt.Println(root.left.data)
fmt.Println(root.data)
fmt.Println(root.right.left.data)
fmt.Println(root.right.data)
}
```
And its output :
```console
student@ubuntu:~/piscine/btreeinsertdata$ go build
student@ubuntu:~/piscine/btreeinsertdata$ ./btreeinsertdata
1
4
5
7
student@ubuntu:~/piscine/btreeinsertdata$
```

4
subjects/btreeisbinary.md

@ -39,7 +39,7 @@ And its output :
```console
student@ubuntu:~/student/btreeisbinary$ go build
student@ubuntu:~/student/btreeisbinary$ ./btreeisbinary
student@ubuntu:~/student/btreeisbinary$ ./btreeisbinary
true
student@ubuntu:~/student/btreeisbinary$
student@ubuntu:~/student/btreeisbinary$
```

4
subjects/btreemax.md

@ -10,7 +10,7 @@ This function must have the following signature.
```go
func BTreeMax(root *TreeNode) *TreeNode {
}
```
@ -42,5 +42,5 @@ And its output :
student@ubuntu:~/student/btreemax$ go build
student@ubuntu:~/student/btreemax$ ./btreemax
7
student@ubuntu:~/student/btreemax$
student@ubuntu:~/student/btreemax$
```

48
subjects/btreeprintroot.en.md

@ -0,0 +1,48 @@
# printroot
## Instructions
Write a function to print the value of the root node of a binary tree.
You have to create a new number and print the value of data
The nodes must be defined as follows:
## Expected function
```go
type TreeNode struct {
left, right *TreeNode
data string
}
func PrintRoot(root *TreeNode){
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
func main() {
//rootNode initialized with the value "who"
//rootNode1 initialized with the value "are"
//rootNode2 initialized with the value "you"
printRoot(rootNode)
printRoot(rootNode1)
printRoot(rootNode2)
}
```
And its output :
```console
student@ubuntu:~/piscine/printroot$ go build
student@ubuntu:~/piscine/printroot$ ./printroot
who
are
you
student@ubuntu:~/piscine/test$
```

74
subjects/btreesearchitem.en.md

@ -0,0 +1,74 @@
# btreeinsertdata
## Instructions
Write a function that searches for an item with a data element equal to elem and return that node
## Expected function
```go
func BTreeSearchItem(root *piscine_test.TreeNode, elem string) *piscine_test.TreeNode {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine "."
)
func main() {
root := &piscine_test.TreeNode{Data: "4"}
piscine_test.BTreeInsertData(root, "1")
piscine_test.BTreeInsertData(root, "7")
piscine_test.BTreeInsertData(root, "5")
selected := BTreeSearchItem(root, "7")
fmt.Print("Item selected -> ")
if selected != nil {
fmt.Println(selected.Data)
} else {
fmt.Println("nil")
}
fmt.Print("Parent of selected item -> ")
if selected.Parent != nil {
fmt.Println(selected.Parent.Data)
} else {
fmt.Println("nil")
}
fmt.Print("Left child of selected item -> ")
if selected.Left != nil {
fmt.Println(selected.Left.Data)
} else {
fmt.Println("nil")
}
fmt.Print("Right child of selected item -> ")
if selected.Right != nil {
fmt.Println(selected.Right.Data)
} else {
fmt.Println("nil")
}
}
```
And its output :
```console
student@ubuntu:~/piscine/btreesearchitem$ go build
student@ubuntu:~/piscine/btreesearchitem$ ./btreesearchitem
Item selected -> 7
Parent of selected item -> 4
Left child of selected item -> 5
Right child of selected item -> nil
student@ubuntu:~/piscine/btreesearchitem$
```

41
subjects/capitalize.en.md

@ -0,0 +1,41 @@
# capitalize
## Instructions
Write a function that capitalizes the first letter of each word **and** lowercases the rest of each word of a `string`.
A word is a sequence of **alphanumerical** characters.
## Expected function
```go
func Capitalize(s string) string {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Capitalize("Hello! How are you? How+are+things+4you?"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How Are You? How+Are+Things+4you?
student@ubuntu:~/piscine/test$
```

41
subjects/capitalize.fr.md

@ -0,0 +1,41 @@
# capitalize
## Instructions
Écrire une fonction qui met en majuscule la premiere lettre de chaque mot et en minuscule les autres lettres du reste du mot d'une `string`.
Un mot est une suite de caractères **alphanumériques**.
## Fonction attendue
```go
func Capitalize(s string) string {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Capitalize("Hello! How are you? How+are+things+4you?"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How Are You? How+Are+Things+4you?
student@ubuntu:~/piscine/test$
```

21
subjects/cl-camp1.en.md

@ -0,0 +1,21 @@
# cl-camp1
## Instructions
A little voice speaks in your head:
"Now that you know who you are. You need to remember what you can do..."
The instincts are coming back...
Put in a file `mastertheLS` the command line that will:
- list the files and folders of the current folder.
- Ignore the hidden files, the "." and the "..".
- Separates the resuls with commas.
- Order them by ascending order of creation date.
- Have the folders have a `/` in front of them.
## Hint
Read the man...

21
subjects/cl-camp1.fr.md

@ -0,0 +1,21 @@
# cl-camp1
## Instructions
Une petite voix dans votre esprit vous dit:
"Maintenant que tu sais qui tu es. Tu dois te souvenir de ce que tu peux faire..."
Les instincts resurgissent...
Mettez dans un fichier `mastertheLS` la ligne de commande qui:
- listera les fichiers et dossiers dans le dossier courant.
- Ignorera les fichiers cachés, le "." et le "..".
- Separarera le resultat avec des virgules.
- Les triera pas ordre croissant de date de création.
- Placera un `/` en face des dossiers.
## Indice
Lisez le man...

17
subjects/cl-camp2.en.md

@ -0,0 +1,17 @@
# cl-camp2
## Instructions
"keep training ..."
Create a file `r`, which shows `R` on a line when the `cat` command is executed
A line is a sequence of characters preceding the [end of line](https://en.wikipedia.org/wiki/Newline) character (`'\n'`).
## Usage
```console
student@ubuntu:~/piscine/test$ cat -e r
R$
student@ubuntu:~/piscine/test$
```

17
subjects/cl-camp2.fr.md

@ -0,0 +1,17 @@
# cl-camp2
## Instructions
"Continue l'entrainement ..."
Créez un fichier `r`, qui affiche `R` sur une ligne quand la commande `cat` command est exécutée.
Une ligne est une suite de caractères précédant le caractère [fin de ligne](https://en.wikipedia.org/wiki/Newline) (`'\n'`).
## Utilisation
```console
student@ubuntu:~/piscine/test$ cat -e r
R$
student@ubuntu:~/piscine/test$
```

15
subjects/cl-camp3.en.md

@ -0,0 +1,15 @@
# cl-camp3
## Instructions
"start looking ..."
Create a file `look`, which will look for and show, in the current directory and its sub-folders all the files :
- starting with an `a` and,
- all the files ending with a `z` and,
- all files starting with `z` and ending with `a!`.
## Hint
Read the `find` man...

15
subjects/cl-camp3.fr.md

@ -0,0 +1,15 @@
# cl-camp3
## Instructions
"commences à chercher ..."
Créer un fichier `look`, qui cherchera et montrera, dans le répertoire courant et ses sous-répertoires, tous les fichiers qui:
- commence avec `a` et,
- tous les fichiers qui se terminent avec `z` et,
- tous les fichiers qui commencent avec `z` et qui se finissenLisezele man dea!`.
#Indice
Lisez le man de `find`...

24
subjects/cl-camp4.en.md

@ -0,0 +1,24 @@
# cl-camp4
## Instructions
"someone familiar"
Create a file `myfamily.sh`, which will show a subject's family (key: relatives).
- The quotes have to be removed.
- The subject will be decided depending on his ID which will be contained in the environment variable HERO_ID.
* Where to look : https://raw.githubusercontent.com/kigiri/superhero-api/master/api/all.json
* What to use : curl, jq and others...
## Usage
```console
student@ubuntu:~/piscine/test$ export HERO_ID=1
student@ubuntu:~/piscine/test$ ./myfamily.sh
Marlo Chandler-Jones (wife); Polly (aunt); Mrs. Chandler (mother-in-law); Keith Chandler, Ray Chandler, three unidentified others (brothers-in-law); unidentified father (deceased); Jackie Shorr (alleged mother; unconfirmed)
student@ubuntu:~/piscine/test$
```

24
subjects/cl-camp4.fr.md

@ -0,0 +1,24 @@
# cl-camp4
## Instructions
"quelqu'un de familier"
Créer un fichier `myfamily.sh`, qui montrera qui affichera la famille d'un individu (clef: relatives).
- Les guillemets doivent être enlevés.
- L'invidu sera choisi en fonction de son ID qui sera contenu dans la variable d'environment HERO_ID.
* Où chercher : https://raw.githubusercontent.com/kigiri/superhero-api/master/api/all.json
* Quoi utiliser : `curl`, `jq` et d'autres...
## Utilisation
```console
student@ubuntu:~/piscine/test$ export HERO_ID=1
student@ubuntu:~/piscine/test$ ./myfamily.sh
Marlo Chandler-Jones (wife); Polly (aunt); Mrs. Chandler (mother-in-law); Keith Chandler, Ray Chandler, three unidentified others (brothers-in-law); unidentified father (deceased); Jackie Shorr (alleged mother; unconfirmed)
student@ubuntu:~/piscine/test$
```

26
subjects/cl-camp5.en.md

@ -0,0 +1,26 @@
# cl-camp5
## Instructions
"keep looking..."
Create a file `lookagain.sh`, which will look for, from the current directory and its sub-folders all the files:
- all the files ending with `.sh`.
That command will only show the name of the files without the `.sh`.
## Usage
```console
student@ubuntu:~/piscine/test$ export HERO_ID=1
student@ubuntu:~/piscine/test$ ./lookagain.sh | cat -e
file1$
file2$
file3$
student@ubuntu:~/piscine/test$
```
## Hint
A little `cut`ing might be useful...

26
subjects/cl-camp5.fr.md

@ -0,0 +1,26 @@
# cl-camp5
## Instructions
"continues à chercher..."
Créer un fichier `lookagain.sh`, qui cherchera et montrera, dans le répertoire courant et ses sous-répertoires, tous les fichiers qui:
- qui finissent avec `.sh`.
Cette commande montrera le nom des fichiers sans le`.sh`.
## Utilisation
```console
student@ubuntu:~/piscine/test$ export HERO_ID=1
student@ubuntu:~/piscine/test$ ./lookagain.sh | cat -e
file1$
file2$
file3$
student@ubuntu:~/piscine/test$
```
## Indice
Un petit `cut`ter pourrait être utile...

15
subjects/cl-camp6.en.md

@ -0,0 +1,15 @@
# cl-camp6
## Instructions
"Now, do your inventory"
Create a file `countfiles.sh`, which will print the number **(and only the number)** of regular files and folders cointaned in the current directory and its sub-folders :
## Usage
```console
student@ubuntu:~/piscine/test$ ./countfiles.sh | cat -e
12$
student@ubuntu:~/piscine/test$
```

15
subjects/cl-camp6.fr.md

@ -0,0 +1,15 @@
# cl-camp6
## Instructions
"Maintenant, fais ton inventaire"
Créer un fichier `countfiles.sh`, qui affichera will lenombre **(et seulement le nombre)** de fichiers réguliers et répertoires contenu dans le répertoire courant et ses sous-répertoires :
## Utilisation
```console
student@ubuntu:~/piscine/test$ ./countfiles.sh | cat -e
12$
student@ubuntu:~/piscine/test$
```

15
subjects/cl-camp7.en.md

@ -0,0 +1,15 @@
# cl-camp7
## Instructions
"Be accurate"
Create a file `"\?$*'ChouMi'*$?\"` that will contain "01" and **nothing else**.
## Usage
```console
student@ubuntu:~/piscine/test$ ls | cat -e
"\?$*'ChouMi'*$?\" $
student@ubuntu:~/piscine/test$
```

15
subjects/cl-camp7.fr.md

@ -0,0 +1,15 @@
# cl-camp7
## Instructions
"Sois précis"
Créer un fichier `"\?$*'ChouMi'*$?\"` qui contiendra "01" et **rien d'autre**.
## Utilisation
```console
student@ubuntu:~/piscine/test$ ls | cat -e
"\?$*'ChouMi'*$?\" $
student@ubuntu:~/piscine/test$
```

11
subjects/cl-camp8.en.md

@ -0,0 +1,11 @@
# cl-camp8
## Instructions
"pick your equipment"
Write a command line in a `skip.sh` file that prints the result of a `ls -l` skipping 1 line out of 2, starting with the **first** one.
## Hint
`awk` or `sed` can do the job.

11
subjects/cl-camp8.fr.md

@ -0,0 +1,11 @@
# cl-camp8
## Instructions
"Choisis ton équipement"
écrire une ligne dans un fichier `skip.sh` qui affiche le résultat d'un `ls -l` qui saute 1 ligne sur 2, en commençant pas la **première**.
## Indice
`awk` ou `sed` peuvent faire le travail.

21
subjects/cl.en.md

@ -0,0 +1,21 @@
# cl-camp1
## Instructions
A little voice speaks in your head:
"Now that you know who you are. You need to remember what you can do..."
The instincts are coming back...
Put in a file `mastertheLS` the command line that will:
- list the files and folders of the current folder.
- Ignore the hidden files, the "." and the "..".
- Separates the resuls with commas.
- Order them by ascending order of creation date.
- Have the folders have a `/` in front of them.
## Hint
Read the man...

114
subjects/commandments.en.md

@ -0,0 +1,114 @@
---
tier: 0
team: 1
duration: 1 hour
objectives: reading the rules
skills: git, github, reading
---
# commandments
A few basic principles to follow
<p align="center">
<img width="476" height="600" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/MCC-31231_Mozes_toont_de_wetstafelen_%281%29.tif/lossy-page1-476px-MCC-31231_Mozes_toont_de_wetstafelen_%281%29.tif.jpg">
</p>
## The Commandements _(read them)_
- Le numérique est ta passion.
- Ton objectif à 42 : développer ton talent et tes compétences pour le marché du numérique.
- L’objectif de 42 pour toi : te faire accéder au marché de l’emploi, à une longue et pérenne carrière dans le numérique, et te faire progresser socialement.
- L’ambition de 42 pour toi : être un pionnier du numérique de demain.
- Il est de ta responsabilité de gérer ta progression : 42 te propose un parcours individualisé adapté à ton rythme.
- Des challenges jalonnent ton parcours. 42 ne fournira aucun élément de solution. C’est ton rôle de chercher et trouver par toi-même ces solutions pour atteindre l’objectif.
- Sois actif. N’attend pas que les choses se fassent pour toi. 42 est un parcours 100% pratique.
- Sois autonome dans ton cursus. N’attend pas que l’on te dise quoi faire.
- Sois collaboratif, autant sur les projets solos que les projets de groupe. Face aux challenges à resoudre, l’échange et le debat sont tes meilleures armes.
- Ne "crois" pas. Sois sûr. Techniquement, relationnelement, organisationellement, administrativement.
- Pour être sûr, teste, contrôle.
- N’ai pas peur de te tromper, d’échouer. L’échec est une étape normale vers le succès.
- Teste à nouveau. Collabore davantage pour tester davantage.
- Ose. Le risque est de se tromper. Voir le commandement 12.
- Sois rigoureux dans ton travail.
- Sois investi dans ton cursus : 50 heures par semaine est un minimum. Ta capacité de travail est une valeur. L’école est ouverte 24h/24 et 7j/7.
- Sois régulier dans ton travail. Un jour oui, un jour non, un coup nocturne, un coup diurne... le chaos t’empêche d’avancer.
- Prévois un groupe de travail large et hétérogène pour y trouver facilement des idées neuves et des groupes de projet.
- Pour tes collaborations et ton travail en groupe, privilégie des étudiants qui n’ont pas déjà la solution au problème.
- Sois investi dans ton groupe de projet, et ne le laisse pas faire ton travail à ta place.
- Ton groupe de projet est solidaire, son succès comme son échec est de la responsabilité de tous, et les conflits se règlent en interne.
- Travaille à l’école. Faire du peer-learning, collaborer, cela demande d’être physiquement avec les autres. A distance cela ne fonctionne pas.
- Implique toi dans les évaluations de tes projets. Elles te permettent de prendre du recul.
- Implique toi dans tes évaluations des projets des autres. La qualité de la communauté en dépend.
- Sois juste et teste rigoureusement tes projets comme ceux des autres en évaluation avec tes propres jeux de tests.
- Joue pleinement le jeu de ta scolarité dans l’état d’esprit demandé, fait tous les exercices et projets demandés.
- Ne cherche pas des biais et des failles dans le système. Tu vas fausser ta propre formation et ta valeur sur le marché.
- Ne triche pas intentionellement. C’est amoral, cela contredit le commandement 12, et c’est du temps inutilement passé à ne pas développer tes compétences pour faire croire aux autres que tu sais coder alors que ce n’est pas le cas.
- Ne rends pas un projet que tu ne serais pas capable de reproduire seul à huis clos. Même si c’est parfois involontaire, c’est aussi de la triche.
- C’est pas pour tes parents que tu travailles, ni pour le staff. C’est pour toi.
- Participe à la vie de la communauté, à son épanouissement, et sa qualité en sortie de formation.
- Aide au respect de ces commandements par la communauté.
- Sois bienveillant et empathique vis à vis de tes camarades comme des personnes avec qui tu interagis, échanges, débats.
- N’ai pas peur du monde professionnel.
- Respecte le matériel. Des consignes spécifiques sont données en ce sens.
- Respecte les locaux. Des consignes spécifiques sont données en ce sens.
- Respecte les gens, étudiants, staffs, partenaires, visiteurs.
- Respecte la loi en vigueur dans le pays.
- Respecte les lois et consignes en vigueur liées à la consommation d’alcool.
- Respecte les lois et consignes en vigueur liées à la consommation de tabac, stupéfiants, ou produits assimilés.
- N’hésite pas à interagir avec le staff, pour parler de tes problèmes, pour remonter des problèmes dans le cursus, pour contribuer au cursus.
- Si tu t’interroges ou ne comprends pas nos choix pédagogiques, demande nous. On ne fait généralement rien au hasard.
## Required
You [clone](http://lmgtfy.com/?q=git+clone) your [fork](http://lmgtfy.com/?q=github+fork) of this [repository](http://lmgtfy.com/?q=git+repository)
and in it, you must create a file named `turn_in` () in which you write EXACTLY the following sentence ending by a line break.
<p align="center">
<img width="600" height="300" src="https://i.imgur.com/2PPQ2iZ.png">
</p>
## Submiting your solution
Your work should be commited and pushed in the master branch of your own fork of this repository.

43
subjects/compare.en.md

@ -0,0 +1,43 @@
# compare
## Instructions
Write a function that behaves like the [`Compare`](https://golang.org/pkg/strings/#Compare) function.
## Expected function
```go
func Compare(a, b string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Compare("Hello!", "Hello!"))
fmt.Println(piscine.Compare("Salut!", "lut!"))
fmt.Println(piscine.Compare("Ola!", "Ol"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
0
-1
1
student@ubuntu:~/piscine/test$
```

43
subjects/compare.fr.md

@ -0,0 +1,43 @@
# compare
## Instructions
Écrire une fonction qui se comporte comme la fonction [`Compare`](https://golang.org/pkg/strings/#Compare).
## Fonction attendue
```go
func Compare(a, b string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Compare("Hello!", "Hello!"))
fmt.Println(piscine.Compare("Salut!", "lut!"))
fmt.Println(piscine.Compare("Ola!", "Ol"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
0
-1
1
student@ubuntu:~/piscine/test$
```

40
subjects/concat.en.md

@ -0,0 +1,40 @@
# concat
## Instructions
Write a function that returns the concatenation of two `string` passed in arguments.
## Expected function
```go
func Concat(str1 string, str2 string) string {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Concat("Hello!", " How are you?"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How are you?
student@ubuntu:~/piscine/test$
```

40
subjects/concat.fr.md

@ -0,0 +1,40 @@
# concat
## Instructions
Écrire une fonction qui retourne la concaténation de deux `string` passées en paramètres.
## Fonction attendue
```go
func Concat(str1 string, str2 string) string {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Concat("Hello!", " How are you?"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello! How are you?
student@ubuntu:~/piscine/test$
```

44
subjects/concatparams.en.md

@ -0,0 +1,44 @@
# concatparams
## Instructions
Write a function that takes the arguments reveived in parameters and returns them as a `string`.
The arguments must be **separated** by a `\n`.
## Expected function
```go
func ConcatParams(args []string) string {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
test := []string{"Hello", "how", "are", "you?"}
fmt.Println(piscine.ConcatParams(test))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello
how
are
you?
student@ubuntu:~/piscine/test$
```

44
subjects/concatparams.fr.md

@ -0,0 +1,44 @@
# concatparams
## Instructions
Écrire une fonction qui prend les arguments en paramètres et les retournes dans une `string`.
Les arguments doivent être **séparés** par un `\n`.
## Fonction attendue
```go
func ConcatParams(args []string) string {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
test := []string{"Hello", "how", "are", "you?"}
fmt.Println(piscine.ConcatParams(test))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
Hello
how
are
you?
student@ubuntu:~/piscine/test$
```

43
subjects/convertbase.en.md

@ -0,0 +1,43 @@
# convertbase
## Instructions
Write a function that returns the convertion of a `string` number from one `string` baseFrom to one `string` baseTo.
Only valid bases will be tested.
Negative numbers will not be tested.
## Expected function
```go
func ConvertBase(nbr, baseFrom, baseTo string) string {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
result := piscine.ConvertBase("101011", "01", "0123456789")
fmt.Println(result)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
43
student@ubuntu:~/piscine/test$
```

43
subjects/convertbase.fr.md

@ -0,0 +1,43 @@
# convertbase
## Instructions
Écrire une fonction qui retourne la convertion d'un nombre `string` d'une baseFrom `string` à une baseTo `string`.
Seules des bases valides seront testées.
Les nombres négatifs ne seront pas testés.
## Fonction attendue
```go
func ConvertBase(nbr, baseFrom, baseTo string) string {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
result := piscine.ConvertBase("101011", "01", "0123456789")
fmt.Println(result)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
43
student@ubuntu:~/piscine/test$
```

44
subjects/countif.en.md

@ -0,0 +1,44 @@
# countif
## Instructions
Write a function `CountIf` that returns the number of elements of a `string` array for which the `f` function returns `true`.
## Expected function
```go
func CountIf(f func(string) bool, tab []string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []string{"Hello", "how", "are", "you"}
tab2 := []string{"This","1", "is", "4", "you"}
answer1 := piscine.CountIf(piscine.IsNumeric, tab1)
answer2 := piscine.CountIf(piscine.IsNumeric, tab2)
fmt.Println(answer1)
fmt.Println(answer2)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
0
2
student@ubuntu:~/piscine/test$
```

44
subjects/countif.fr.md

@ -0,0 +1,44 @@
# countif
## Instructions
Écrire une fonction `CountIf` qui retournes le nombre d'éléments d'un tableau de `string` pour lesquels la fonction `f` retourne `true`.
## Fonction attendue
```go
func CountIf(f func(string) bool, tab []string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []string{"Hello", "how", "are", "you"}
tab2 := []string{"This","1", "is", "4", "you"}
answer1 := piscine.CountIf(piscine.IsNumeric, tab1)
answer2 := piscine.CountIf(piscine.IsNumeric, tab2)
fmt.Println(answer1)
fmt.Println(answer2)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
0
2
student@ubuntu:~/piscine/test$
```

50
subjects/divmod.en.md

@ -0,0 +1,50 @@
# divmod
## Instructions
- Write a function that will be formatted as below.
## Expected function
```go
func DivMod(a int, b int, div *int, mod *int) {
}
```
- This function will divide the int **a** and **b**.
- The result of this division will be stored in the int pointed by **div**.
- The remainder of this division will be stored in the int pointed by **mod**.
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
a := 13
b := 2
var div int
var mod int
piscine.DivMod(a, b, &div, &mod)
fmt.Println(div)
fmt.Println(mod)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
6
1
student@ubuntu:~/piscine/test$
```

50
subjects/divmod.fr.md

@ -0,0 +1,50 @@
# divmod
## Instructions
- Écrire une fonction qui aura le format ci-dessous.
## Fonction attendue
```go
func DivMod(a int, b int, div *int, mod *int) {
}
```
- Cette fonction divisera les int **a** et **b**.
- Le résultat de la division sera stocké dans l'int pointé par **div**.
- Le reste de cette division sera stocké dans l'int pointé par **mod**.
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
a := 13
b := 2
var div int
var mod int
piscine.DivMod(a, b, &div, &mod)
fmt.Println(div)
fmt.Println(mod)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
6
1
student@ubuntu:~/piscine/test$
```

39
subjects/doop.en.md

@ -0,0 +1,39 @@
# doop
## Instructions
Write a [program](TODO-LINK) that is called `doop`.
The program has to be used with three arguments:
- A value
- An operator
- Another value
In case of an invalid entry the programs prints `0`.
In case of an invalid number of arguments the program prints nothing.
`fmt.Print` is authorized.
## Usage
```console
student@ubuntu:~/piscine/test$ go build doop.go
student@ubuntu:~/piscine/test$ ./doop
student@ubuntu:~/piscine/test$ ./doop 1 + 1
2
student@ubuntu:~/piscine/test$ ./doop hello + 1
0
student@ubuntu:~/piscine/test$ ./doop 1 p 1
0
student@ubuntu:~/piscine/test$ ./doop 1 + 1
2
student@ubuntu:~/piscine/test$ ./doop 1 / 0
No division by 0
student@ubuntu:~/piscine/test$ ./doop 1 % 0
No modulo by 0
student@ubuntu:~/piscine/test$ ./doop 1 * 1
1
```

39
subjects/doop.fr.md

@ -0,0 +1,39 @@
# doop
## Instructions
Écrire un [programme](TODO-LINK) qui s'apelle `doop`.
Le programme doit être utilisé avec trois arguments:
- Une valeur
- Un opérateur
- Une autre valeur
En cas d'argument invalide le programme affiche `0`.
En cas de nombre invalide d'arguments le programme affiche rien.
`fmt.Print` est autorisé.
## Utilisation
```console
student@ubuntu:~/piscine/test$ go build doop.go
student@ubuntu:~/piscine/test$ ./doop
student@ubuntu:~/piscine/test$ ./doop 1 + 1
2
student@ubuntu:~/piscine/test$ ./doop hello + 1
0
student@ubuntu:~/piscine/test$ ./doop 1 p 1
0
student@ubuntu:~/piscine/test$ ./doop 1 + 1
2
student@ubuntu:~/piscine/test$ ./doop 1 / 0
No division by 0
student@ubuntu:~/piscine/test$ ./doop 1 % 0
No modulo by 0
student@ubuntu:~/piscine/test$ ./doop 1 * 1
1
```

33
subjects/eightqueens.en.md

@ -0,0 +1,33 @@
# eightqueens
## Intructions
Write a function that prints the solutions to the [eight queens puzzle](https://en.wikipedia.org/wiki/Eight_queens_puzzle).
Recursivity must be used to solve this problem.
It should print something like this :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
15863724
16837425
17468253
...
```
Each solution will be on a single line.
The index of the placement of a queen starts at 1.
It reads from left to right and each digit is the position for each column.
The solutions will be printed in ascending order.
## Expected function
```go
package main
func EightQueens() {
}
```

33
subjects/eightqueens.fr.md

@ -0,0 +1,33 @@
# eightqueens
## Intructions
Écrire une [fonction](TODO-LINK) qui affiche toutes les solutions du [problème des huit dames](https://en.wikipedia.org/wiki/Eight_queens_puzzle).
La récursion doit être utilisée pour résoudre ce problème.
L'affichage sera quelque chose comme ça :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
15863724
16837425
17468253
...
```
Chaque solution sera sur une ligne unique.
L'index du placement d'une reine commence à 1.
Elle se lit de gauche à droite et chaque chiffre est la position pour chacune des colonnes.
Les solutions seront affichées dans l'ordre croissant.
## Fonction attendue
```go
package main
func EightQueens() {
}
```

50
subjects/fibonacci.en.md

@ -0,0 +1,50 @@
# fibonacci
## Intructions
Write an **recursive** function that returns the value of fibonacci sequence matching the index passed as parameter.
The first value is at index `0`.
The sequence starts this way: 0, 1, 1, 2, 3 etc...
A negative index will return `-1`.
`for` is **forbidden** for this exercise.
## Expected function
```go
package main
func Fibonacci(int index) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 4
fmt.Println(piscine.Fibonacci(arg1))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
3
student@ubuntu:~/piscine/test$
```

51
subjects/fibonacci.fr.md

@ -0,0 +1,51 @@
# fibonacci
## Intructions
Écrire une fonction **récursive** qui renvoie la valeur de la suite de fibonacci correspondant à l'index passé en paramètre.
La premiére valeur est à l'index `0`.
La suite débute ainsi: 0, 1, 1, 2, 3 etc...
Un index négatif renvoie `-1`.
`for` est **interdit** pour cet exercice.
## Fonction attendue
```go
package main
func Fibonacci(int index) int {
}
```
## Utilisation
Voici un éventuel `main.go` :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 4
fmt.Println(piscine.Fibonacci(arg1))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$go build
student@ubuntu:~/piscine/test$ ./test
3
student@ubuntu:~/piscine/test$
```

41
subjects/findnextprime.en.md

@ -0,0 +1,41 @@
# findnextprime
## Intructions
Write a function that returns the first prime number that is equal or superior to the `int` passed as parameter.
## Expected function
```go
func FindNextPrime(int nb) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.FindNextPrime(5))
fmt.Println(piscine.FindNextPrime(4))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
5
5
student@ubuntu:~/piscine/test$
```

43
subjects/findnextprime.fr.md

@ -0,0 +1,43 @@
# findnextprime
## Intructions
Écrire une fonction qui renvoie le premier nombre premier qui est égal ou supérieur à l'`int` passé en paramètre.
## Fonction attendue
```go
func FindNextPrime(int nb) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 5
arg2 := 4
fmt.Println(piscine.FindNextPrime(arg1))
fmt.Println(piscine.FindNextPrime(arg2))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
5
5
student@ubuntu:~/piscine/test$
```

1
subjects/firebase-demo.en.md

@ -0,0 +1 @@
# firebase-demo

42
subjects/firstrune.en.md

@ -0,0 +1,42 @@
# firstrune
## Instructions
Write a function that returns the first `rune` of a `string`.
## Expected function
```go
func FirstRune(s string) rune {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"github.com/01-edu/z01"
piscine ".."
)
func main() {
z01.PrintRune(piscine.FirstRune("Hello!"))
z01.PrintRune(piscine.FirstRune("Salut!"))
z01.PrintRune(piscine.FirstRune("Ola!"))
z01.PrintRune('\n')
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
HSO
student@ubuntu:~/piscine/test$
```

42
subjects/firstrune.fr.md

@ -0,0 +1,42 @@
# firstrune
## Instructions
Écrire une fonction qui retourne la première `rune` d'une `string`.
## Fonction attendue
```go
func FirstRune(s string) rune {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"github.com/01-edu/z01"
piscine ".."
)
func main() {
z01.PrintRune(piscine.FirstRune("Hello!"))
z01.PrintRune(piscine.FirstRune("Salut!"))
z01.PrintRune(piscine.FirstRune("Ola!"))
z01.PrintRune('\n')
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
HSO
student@ubuntu:~/piscine/test$
```

36
subjects/foreach.en.md

@ -0,0 +1,36 @@
# foreach
## Instructions
Write a function `ForEach` that, for an `int` array, applies a function on each elements of that array.
## Expected function
```go
func ForEach(f func(int), arr []int) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import piscine ".."
func main() {
arr := []int{1, 2, 3, 4, 5, 6}
piscine.ForEach(piscine.PrintNbr, arr)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
123456
student@ubuntu:~/piscine/test$
```

36
subjects/foreach.fr.md

@ -0,0 +1,36 @@
# foreach
## Instructions
Écrire une fonction `ForEach` qui, pour un tableau d'`int`, applique une fonction sur chaque éléments de ce tableau.
## Fonction attendue
```go
func ForEach(f func(int), arr []int) {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import piscine ".."
func main() {
arr := []int{1, 2, 3, 4, 5, 6}
piscine.ForEach(piscine.PutNbr, arr)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
123456
student@ubuntu:~/piscine/test$
```

3
subjects/functions.en.md

@ -0,0 +1,3 @@
# functions
This repository aggregate every functions of the Zone 01 organization

7
subjects/get-ready.en.md

@ -0,0 +1,7 @@
# get-ready
## Instructions
Subscribe to [Discord](Discord-invite-link) and send a private message to the bot (TODO: find a name for the bot).
If the bot likes you, the bot will greet you in a in a pleasant manner.

20
subjects/go-say-hello.en.md

@ -0,0 +1,20 @@
# go-say-hello
## Instructions
Write a [program](TODO-LINK) that says `hello` to your GitHub username.
## Usage
Where `{username}` is your GitHub username:
```console
user@host:~/piscine/d01/go-say-hello$ go get -u github.com/{username}/piscine/d01/go-say-hello
user@host:~/piscine/d01/go-say-hello$ go run github.com/{username}/piscine/d01/go-say-hello
Hello, {username}!
<<<<<<< HEAD
$
=======
user@host:~/piscine/d01/go-say-hello$
>>>>>>> 95ba96142e4855232e0d1fbdf38a3bedae3ed625
```

15
subjects/go-say-hello.fr.md

@ -0,0 +1,15 @@
# gosayhello
## Instructions
Écrire un [programme](TODO-LINK) qui vous dis `hello` à votre GitHub username.
## Utilisation
Ici `{username}` est votre GitHub username:
```console
$ go run github.com/{username}/piscine/d01/gosayhello
Hello, {username}!
$
```

43
subjects/index.en.md

@ -0,0 +1,43 @@
# index
## Instructions
Write a function that behaves like the [`Index`](https://golang.org/pkg/strings/#Index) function.
## Expected function
```go
func Index(s string, toFind string) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Index("Hello!", "l"))
fmt.Println(piscine.Index("Salut!", "alu"))
fmt.Println(piscine.Index("Ola!", "hOl"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
2
1
-1
student@ubuntu:~/piscine/test$
```

43
subjects/index.fr.md

@ -0,0 +1,43 @@
# index
## Instructions
Écrire une fonction qui se comporte comme la fonction [`Index`](https://golang.org/pkg/strings/#Index).
## Fonction attendue
```go
func Index(s string, toFind string) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.Index("Hello!", "l"))
fmt.Println(piscine.Index("Salut!", "alu"))
fmt.Println(piscine.Index("Ola!", "hOl"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
2
1
-1
student@ubuntu:~/piscine/test$
```

46
subjects/isalpha.en.md

@ -0,0 +1,46 @@
# isalpha
## Instructions
Write a function that returns `true` if the `string` passed in parameter only contains alphanumerical characters, and that returns `false` otherwise.
## Expected function
```go
func IsAlpha(str string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsAlpha("Hello! How are you?"))
fmt.Println(piscine.IsAlpha("HelloHowareyou"))
fmt.Println(piscine.IsAlpha("What's this 4?"))
fmt.Println(piscine.IsAlpha("Whatsthis4"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
false
true
false
true
student@ubuntu:~/piscine/test$
```

46
subjects/isalpha.fr.md

@ -0,0 +1,46 @@
# isalpha
## Instructions
Écrire une fonction qui retourne `true` si la `string` passée en paramètre contient seulement des caractères alphanumériques, et qui retourne `false` autrement.
## Fonction attendue
```go
func IsAlpha(str string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsAlpha("Hello! How are you?"))
fmt.Println(piscine.IsAlpha("HelloHowareyou"))
fmt.Println(piscine.IsAlpha("What's this 4?"))
fmt.Println(piscine.IsAlpha("Whatsthis4"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
false
true
false
true
student@ubuntu:~/piscine/test$
```

42
subjects/islower.en.md

@ -0,0 +1,42 @@
# islower
## Instructions
Write a function that returns `true` if the `string` passed in parameter only contains lowercase characters, and that returns `false` otherwise.
## Expected function
```go
func IsLower(str string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsLower("hello"))
fmt.Println(piscine.IsLower("hello!"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

42
subjects/islower.fr.md

@ -0,0 +1,42 @@
# islower
## Instructions
Écrire une fonction qui retourne `true` si la `string` passée en paramètre contient seulement des caractères minuscules, et qui retourne `false` autrement.
## Fonction attendue
```go
func IsLower(str string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsLower("hello"))
fmt.Println(piscine.IsLower("hello!"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

40
subjects/isnegative.en.md

@ -0,0 +1,40 @@
# isnegative
## Instructions
Write a [function](TODO-LINK) that prints `'T'` (true) on a single line if the `int` passed as parameter is negative, otherwise it prints `'F'` (false).
## Expected function
```go
func IsNegative(nb int) {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import piscine ".."
func main() {
piscine.IsNegative(1)
piscine.IsNegative(0)
piscine.IsNegative(-1)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
F
F
T
student@ubuntu:~/piscine/test$
```

40
subjects/isnegative.fr.md

@ -0,0 +1,40 @@
# isnegative
## Instructions
Écrire une [fonction](TODO-LINK) qui affiche `'T'` (true) sur une seule ligne si l'`int` passé en paramètre est négatif, sinon elle affiche `'F'` (false).
## Fonction attendue
```go
func IsNegative(nb int) {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import piscine ".."
func main() {
piscine.IsNegative(1)
piscine.IsNegative(0)
piscine.IsNegative(-1)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
F
F
T
student@ubuntu:~/piscine/test$
```

41
subjects/isnumeric.en.md

@ -0,0 +1,41 @@
# isnumeric
## Instructions
Write a function that returns `true` if the `string` passed in parameter only contains numerical characters, and that returns `false` otherwise.
## Expected function
```go
func IsNumeric(str string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsNumeric("010203"))
fmt.Println(piscine.IsNumeric("01,02,03"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

42
subjects/isnumeric.fr.md

@ -0,0 +1,42 @@
# isnumeric
## Instructions
Écrire une fonction qui retourne `true` si la `string` passée en paramètre contient seulement des caractères numériques, et qui retourne `false` autrement.
## Fonction attendue
```go
func IsNumeric(str string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsNumeric("010203"))
fmt.Println(piscine.IsNumeric("01,02,03"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

41
subjects/isprime.en.md

@ -0,0 +1,41 @@
# isprime
## Intructions
Write a function that returns `true` if the `int` passed as parameter is a prime number. Otherwise it returns `false`.
## Expected function
```go
func IsPrime(int nb) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsPrime(5))
fmt.Println(piscine.IsPrime(4))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

41
subjects/isprime.fr.md

@ -0,0 +1,41 @@
# isprime
## Intructions
Écrire une fonction qui renvoie `true` si l'`int` passé en paramètre est un nombre premier. Autrement elle renvoie `false`.
## Fonction attendue
```go
func IsPrime(int nb) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsPrime(5))
fmt.Println(piscine.IsPrime(4))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

43
subjects/isprintable.en.md

@ -0,0 +1,43 @@
# isprintable
## Instructions
Write a function that returns `true` if the `string` passed in parameter only contains printable characters, and that returns `false` otherwise.
## Expected function
```go
package main
func IsPrintable(str string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsPrintable("Hello"))
fmt.Println(piscine.IsPrintable("Hello\n"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

43
subjects/isprintable.fr.md

@ -0,0 +1,43 @@
# isprintable
## Instructions
Écrire une fonction qui retourne `true` si la `string` passée en paramètre contient seulement des caractères majuscules, et qui retourne `false` autrement.
## Fonction attendue
```go
package main
func IsPrintable(str string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsPrintable("Hello"))
fmt.Println(piscine.IsPrintable("Hello\n"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

51
subjects/issorted.en.md

@ -0,0 +1,51 @@
# issorted
## Instructions
Write a function `IsSorted` that returns `true` if the slice of `int` is sorted, and that returns `false` otherwise.
The function passed in parameter returns a positive `int` if `a`(the first argument) is superior to `b`(the second argument),
it returns `0` if they are equal and it returns a negative `int` otherwise.
To do your testing you have to write your own `f` function.
## Expected function
```go
func IsSorted(f func(a, b int) int, tab []int) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function (without `f`):
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []int{0, 1, 2, 3, 4, 5}
tab2 := []int{0, 2, 1, 3}
result1 := piscine.IsSorted(f, tab1)
result2 := piscine.IsSorted(f, tab2)
fmt.Println(result1)
fmt.Println(result2)
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

50
subjects/issorted.fr.md

@ -0,0 +1,50 @@
# issorted
## Instructions
Écrire une fonction `IsSorted` qui retourne `true` si la slice d'`int` est triée, et qui retourne `false` autrement.
La fonction passée en paramètre retourne un `int` positive si `a` (le premier argument) est supérieur à `b`(le deuxième argument), elle retourne `0` si ils sont égaux et elle retourne un `int` négatif autrement.
Pour faire vos tests, vous devez coder votre propre fonction `f`.
## Fonction attendue
```go
func IsSorted(f func(a, b int) int, tab []int) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction (sans `f`) :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []int{0, 1, 2, 3, 4, 5}
tab2 := []int{0, 2, 1, 3}
result1 := piscine.IsSorted(f, tab1)
result2 := piscine.IsSorted(f, tab2)
fmt.Println(result1)
fmt.Println(result2)
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

42
subjects/isupper.en.md

@ -0,0 +1,42 @@
# isupper
## Instructions
Write a function that returns `true` if the `string` passed in parameter only contains uppercase characters, and that returns `false` otherwise.
## Expected function
```go
func IsUpper(str string) bool {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsUpper("HELLO"))
fmt.Println(piscine.IsUpper("HELLO!"))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
student@ubuntu:~/piscine/test$
```

42
subjects/isupper.fr.md

@ -0,0 +1,42 @@
# isupper
## Instructions
Écrire une fonction qui retourne `true` si la `string` passée en paramètre contient seulement des caractères majuscules, et qui retourne `false` autrement.
## Fonction attendue
```go
func IsUpper(str string) bool {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
fmt.Println(piscine.IsUpper("HELLO"))
fmt.Println(piscine.IsUpper("HELLO!"))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
true
false
stude0t@ubuntu:~$
```

42
subjects/iterativefactorial.en.md

@ -0,0 +1,42 @@
# iterativefactorial
## Intructions
Write an **iterative** function that returns the factorial of the `int` passed as parameter.
Errors (non possible values or overflows) will return `0`.
## Expected function
```go
func IterativeFactorial(int nb) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
arg := 4
fmt.Println(piscine.IterativeFactorial(arg))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
24
student@ubuntu:~/piscine/test$
```

42
subjects/iterativefactorial.fr.md

@ -0,0 +1,42 @@
# iterativefactorial
## Intructions
Écrire une fonction **itérative** qui renvoie la factorielle d'un `int` passé en paramètre.
Les erreurs (valeurs non possibles ou overflows) renverront `0`.
## Fonction attendue
```go
func IterativeFactorial(int nb) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
arg := 4
fmt.Println(piscine.IterativeFactorial(arg))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
24
student@ubuntu:~/piscine/test$
```

44
subjects/iterativepower.en.md

@ -0,0 +1,44 @@
# iterativepower
## Intructions
Write an **iterative** function that returns the power of the `int` passed as parameter.
Negative powers will return `0`. Overflows do **not** have to be dealt with.
## Expected function
```go
func IterativePower(int nb, int power) int {
}
```
## Usage
Here is a possible [program](TODO-LINK) to test your function :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 4
arg2 := 3
fmt.Println(piscine.IterativePower(arg1, arg2))
}
```
And its output :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
64
student@ubuntu:~/piscine/test$
```

44
subjects/iterativepower.fr.md

@ -0,0 +1,44 @@
# iterativepower
## Intructions
Écrire une fonction **itérative** qui renvoie la puissance de deux `int` passés en paramètre.
Les puissances négatives renverront `0`. Les overflows **ne doivent pas** être gérés.
## Fonction attendue
```go
func IterativePower(int nb, int power) int {
}
```
## Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
        "fmt"
        piscine ".."
)
func main() {
arg1 := 4
arg2 := 3
fmt.Println(piscine.IterativePower(arg1, arg2))
}
```
Et son résultat :
```console
student@ubuntu:~/piscine/test$ go build
student@ubuntu:~/piscine/test$ ./test
64
student@ubuntu:~/piscine/test$
```

Some files were not shown because too many files changed in this diff diff.show_more

Loading…
Cancel
Save