From 2c3592e5fced04da90f5f6db661855a03d856a7a Mon Sep 17 00:00:00 2001 From: Clement Denis Date: Wed, 24 Apr 2019 12:15:11 +0100 Subject: [PATCH] fix errors and normalize style in subjects --- subjects/abort.md | 6 +++--- subjects/activebits.md | 7 +++---- subjects/bool.md | 14 +++++++------- subjects/btreeapplybylevel.md | 6 +++--- subjects/btreedeletenode.md | 5 +++-- subjects/btreeisbinary.md | 8 ++++---- subjects/btreelevelcount.md | 10 +++++----- subjects/btreemax.md | 6 +++--- subjects/btreemin.md | 10 +++++----- subjects/btreetransplant.md | 10 +++++----- subjects/cat.md | 10 +++++----- subjects/collatzcountdown.md | 10 +++++----- subjects/comcheck.md | 1 + subjects/compact.md | 4 ++-- subjects/countdown.md | 2 +- subjects/createelem.md | 3 +-- subjects/dispfirstpar.md | 2 +- subjects/displastpar.md | 2 +- subjects/displaya.md | 2 +- subjects/displayalpham.md | 3 ++- subjects/displayalrevm.md | 3 ++- subjects/displayfile.md | 4 ++-- subjects/displayz.md | 2 +- subjects/enigma.md | 10 +++++----- subjects/firstword.md | 4 ++-- subjects/fixthemain.md | 3 ++- subjects/hello.md | 2 +- subjects/inter.md | 5 ++--- subjects/join.md | 9 ++++----- subjects/lastword.md | 1 + subjects/listat.md | 3 +-- subjects/listclear.md | 3 +-- subjects/listfind.md | 2 +- subjects/listforeachif.md | 3 ++- subjects/listlast.md | 3 +-- subjects/listmerge.md | 2 +- subjects/listpushback.md | 2 +- subjects/listpushfront.md | 2 +- subjects/listpushpara.md | 8 +++----- subjects/listremoveif.md | 2 -- subjects/listreverse.md | 2 +- subjects/listsize.md | 3 +-- subjects/listsort.md | 4 +--- subjects/max.md | 9 ++++----- subjects/onlya.md | 2 +- subjects/onlyz.md | 3 ++- subjects/pilot.md | 6 +++--- subjects/point.md | 22 ++++++++++------------ subjects/rectangle.md | 13 ++++++------- subjects/repeatalpha.md | 5 +++-- subjects/reversebits.md | 20 +++++++++++++------- subjects/rot13.md | 4 ++-- subjects/rot14.md | 2 +- subjects/searchreplace.md | 6 +++--- subjects/sortlistinsert.md | 4 ++-- subjects/strlen.md | 2 +- subjects/swapbits.md | 21 ++++++++++++++------- subjects/switchcase.md | 8 ++++---- subjects/union.md | 1 + subjects/unmatch.md | 9 ++++----- subjects/wdmatch.md | 5 ++--- subjects/ztail.md | 2 +- 62 files changed, 175 insertions(+), 172 deletions(-) diff --git a/subjects/abort.md b/subjects/abort.md index 52ef41bd..5a9a24d5 100644 --- a/subjects/abort.md +++ b/subjects/abort.md @@ -1,4 +1,5 @@ ## abort + ### Instructions Write a function that returns the the value in the middle of 5 five arguments. @@ -11,7 +12,6 @@ This function must have the following signature. func Abort(a, b, c, d, e int) int { } - ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/activebits.md b/subjects/activebits.md index 7914ce74..4cddadc9 100644 --- a/subjects/activebits.md +++ b/subjects/activebits.md @@ -1,4 +1,5 @@ ## activebits + ### Instructions Write a function, ActiveBitsthat, that returns the number of active bits (bits with the value 1) in the binary representation of an integer number. @@ -8,11 +9,9 @@ The function must have the next signature. ### Expected function ```go - func ActiveBits(n int) uint { } - ``` ### Usage @@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/bool.md b/subjects/bool.md index 96aa3114..2c23b376 100644 --- a/subjects/bool.md +++ b/subjects/bool.md @@ -1,4 +1,4 @@ - # Boolean +## Boolean ### Instructions @@ -7,7 +7,6 @@ Create a `.go` file and copy the code below into our file - The main task is to return a working program. ```go - func printStr(str string) { arrayStr := []rune(str) @@ -18,7 +17,6 @@ func printStr(str string) { } func isEven(nbr int) boolean { - if even(nbr) == 1 { return yes } else { @@ -27,7 +25,6 @@ func isEven(nbr int) boolean { } func main() { - if isEven(lengthOfArg) == 1 { printStr(EvenMsg) } else { @@ -37,10 +34,13 @@ func main() { ``` ### Expected output -```go + +```console I have an even number of arguments ``` + ### Or -```go + +```console I have an odd number of arguments -``` \ No newline at end of file +``` diff --git a/subjects/btreeapplybylevel.md b/subjects/btreeapplybylevel.md index a2eae917..6f04850d 100644 --- a/subjects/btreeapplybylevel.md +++ b/subjects/btreeapplybylevel.md @@ -1,4 +1,5 @@ ## btreeapplybylevel + ### Instructions Write a function, BTreeApplyByLevel, that applies the function given by fn to each node of the tree given by root. @@ -11,7 +12,6 @@ This function must have the following signature. func BTreeApplyByLevel(root *TreeNode, fn interface{}) { } - ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/btreedeletenode.md b/subjects/btreedeletenode.md index 33fc98c5..6a7256d0 100644 --- a/subjects/btreedeletenode.md +++ b/subjects/btreedeletenode.md @@ -1,4 +1,5 @@ ## btreedeletenode + ### Instructions Write a function, BTreeDeleteNode, that deletes 'node' from the tree given by root. @@ -24,8 +25,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/btreeisbinary.md b/subjects/btreeisbinary.md index f89e580f..c9cfe7a0 100644 --- a/subjects/btreeisbinary.md +++ b/subjects/btreeisbinary.md @@ -1,4 +1,5 @@ ## btreeisbinary + ### Instructions Write a function, BTreeIsBinary, that returns true only if the tree given by root follows the binary search tree properties. @@ -9,9 +10,8 @@ This function must have the following signature. ```go func BTreeIsBinary(root *TreeNode) bool { - -} +} ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/btreelevelcount.md b/subjects/btreelevelcount.md index 8610e2a7..bfb4986c 100644 --- a/subjects/btreelevelcount.md +++ b/subjects/btreelevelcount.md @@ -1,15 +1,15 @@ ## btreelevelcount + ### Instructions -Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree) +Write a function, BTreeLevelCount, that return the number of levels of the tree (height of the tree) ### Expected function ```go func BTreeLevelCount(root *piscine.TreeNode) int { - -} +} ``` ### Usage @@ -20,8 +20,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/btreemax.md b/subjects/btreemax.md index 76ab4dd5..eba72baf 100644 --- a/subjects/btreemax.md +++ b/subjects/btreemax.md @@ -1,4 +1,5 @@ ## btreemax + ### Instructions Write a function, BTreeMax, that returns the node with the maximum value in the tree given by root @@ -11,7 +12,6 @@ This function must have the following signature. func BTreeMax(root *TreeNode) *TreeNode { } - ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { diff --git a/subjects/btreemin.md b/subjects/btreemin.md index 6f5a43db..27b0f7a7 100644 --- a/subjects/btreemin.md +++ b/subjects/btreemin.md @@ -1,4 +1,5 @@ ## btreemin + ### Instructions Write a function, BTreeMin, that returns the node with the minimum value in the tree given by root @@ -9,9 +10,8 @@ This function must have the following signature. ```go func BTreeMin(root *TreeNode) *TreeNode { - -} +} ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -42,5 +42,5 @@ And its output : student@ubuntu:~/student/btreemin$ go build student@ubuntu:~/student/btreemin$ ./btreemin 1 -student@ubuntu:~/student/btreemin$ +student@ubuntu:~/student/btreemin$ ``` diff --git a/subjects/btreetransplant.md b/subjects/btreetransplant.md index ff10f5b2..e8093914 100644 --- a/subjects/btreetransplant.md +++ b/subjects/btreetransplant.md @@ -1,4 +1,5 @@ ## btreetransplant + ### Instructions In order to move subtrees around within the binary search tree, write a function, BTreeTransplant, which replaces the subtree started by node with the node called 'rplc' in the tree given by root. @@ -9,9 +10,8 @@ This function must have the following signature. ```go func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode { - -} +} ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -47,5 +47,5 @@ student@ubuntu:~/student/btreetrandsplant$ ./btreetransplant 4 5 7 -student@ubuntu:~/student/btreetrandsplant$ +student@ubuntu:~/student/btreetrandsplant$ ``` diff --git a/subjects/cat.md b/subjects/cat.md index 681b933d..e285e01b 100644 --- a/subjects/cat.md +++ b/subjects/cat.md @@ -6,17 +6,17 @@ Write a program that does the same thing as the system's `cat` command-line. - You don't have to handle options. -- But if just call the program with out arguments it should take a input and print it back +- But if just call the program with out arguments it should take a input and print it back - In the program folder create two files named `quest8.txt` and `quest8T.txt`. - Copy to the `quest8.txt` file this : - - - "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing -- Copy to the `quest8T.txt` file this : + - "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing - - "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence." +- Copy to the `quest8T.txt` file this : + + - "Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence." - In case of error it should print the error. diff --git a/subjects/collatzcountdown.md b/subjects/collatzcountdown.md index d4aa2208..991cc5b6 100644 --- a/subjects/collatzcountdown.md +++ b/subjects/collatzcountdown.md @@ -1,4 +1,5 @@ ## collatzcountdown + ### Instructions Write a function, CollatzCountdown, that returns the number of steps to reach 1 using the collatz countdown. @@ -9,9 +10,8 @@ The function must have the following signature. ```go func CollatzCountdown(start int) int { - -} +} ``` ### Usage @@ -22,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -38,5 +38,5 @@ And its output : student@ubuntu:~/student/collatzcountdown$ go build student@ubuntu:~/student/collatzcountdown$ ./collatzcountdown 10 -student@ubuntu:~/student/collatzcountdown$ +student@ubuntu:~/student/collatzcountdown$ ``` diff --git a/subjects/comcheck.md b/subjects/comcheck.md index dcf010c7..e76f2314 100644 --- a/subjects/comcheck.md +++ b/subjects/comcheck.md @@ -13,6 +13,7 @@ func rot14(str string) string { } ``` + ### Usage Here is a possible [program](TODO-LINK) to test your function : diff --git a/subjects/compact.md b/subjects/compact.md index 98b1c1bf..4f35ffe7 100644 --- a/subjects/compact.md +++ b/subjects/compact.md @@ -4,7 +4,7 @@ Write a function that will take a pointer to a array as parameter and overwrites any element that points to `nil`. -- If you not sure what the function does. It exists in Ruby. +- If you not sure what the function does. It exists in Ruby. ### Expected functions @@ -13,6 +13,7 @@ func Compact(ptr *[]string, length int) int { } ``` + ### Usage Here is a possible [program](TODO-LINK) to test your function : @@ -28,7 +29,6 @@ func main() { ptr := &array fmt.Println(Compact(ptr, len(array))) } - ``` And its output : diff --git a/subjects/countdown.md b/subjects/countdown.md index 523a5082..58154f76 100644 --- a/subjects/countdown.md +++ b/subjects/countdown.md @@ -14,4 +14,4 @@ student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test 9876543210 student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/createelem.md b/subjects/createelem.md index 91a03c34..ecdb9ea7 100644 --- a/subjects/createelem.md +++ b/subjects/createelem.md @@ -2,7 +2,7 @@ ### Instructions -Write a function `CreateElem` that creates a new element of type`Node`. +Write a function `CreateElem` that creates a new element of type`Node`. ### Expected function and structure @@ -14,7 +14,6 @@ type Node struct { func CreateElem(n *Node, value int) { } - ``` ### Usage diff --git a/subjects/dispfirstpar.md b/subjects/dispfirstpar.md index 86678679..5ef10429 100644 --- a/subjects/dispfirstpar.md +++ b/subjects/dispfirstpar.md @@ -14,4 +14,4 @@ student@ubuntu:~/piscine/test$ ./test "hello there" how are you hello there student@ubuntu:~/piscine/test$ ./test student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/displastpar.md b/subjects/displastpar.md index 2cbc6625..42c394a3 100644 --- a/subjects/displastpar.md +++ b/subjects/displastpar.md @@ -16,4 +16,4 @@ student@ubuntu:~/piscine/test$ ./test "hello there" hello there student@ubuntu:~/piscine/test$ ./test student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/displaya.md b/subjects/displaya.md index 55ba33f6..5695452f 100644 --- a/subjects/displaya.md +++ b/subjects/displaya.md @@ -19,4 +19,4 @@ student@ubuntu:~/piscine/test$ ./test "bcvbvA" a student@ubuntu:~/piscine/test$ ./test "nbv" student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/displayalpham.md b/subjects/displayalpham.md index 53aa98dd..99a72239 100644 --- a/subjects/displayalpham.md +++ b/subjects/displayalpham.md @@ -1,4 +1,5 @@ ## displayalpham + ### Instructions Write a program that displays the alphabet, with even letters in uppercase, and @@ -12,5 +13,5 @@ Example : student@ubuntu:~/student/displayalpham$ go build student@ubuntu:~/student/displayalpham$ ./displayalpham | cat -e aBcDeFgHiJkLmNoPqRsTuVwXyZ$ -student@ubuntu:~/student/displayalpham$ +student@ubuntu:~/student/displayalpham$ ``` diff --git a/subjects/displayalrevm.md b/subjects/displayalrevm.md index b1f4fda8..f428f649 100644 --- a/subjects/displayalrevm.md +++ b/subjects/displayalrevm.md @@ -1,4 +1,5 @@ ## displayalrevm + ### Instructions Write a program that displays the alphabet in reverse, with even letters in @@ -12,5 +13,5 @@ Example : student@ubuntu:~/student/displayalrevm$ go build student@ubuntu:~/student/displayalrevm$ ./displayalrevm | cat -e aBcDeFgHiJkLmNoPqRsTuVwXyZ$ -student@ubuntu:~/student/displayalrevm$ +student@ubuntu:~/student/displayalrevm$ ``` diff --git a/subjects/displayfile.md b/subjects/displayfile.md index 74f74505..1f1bce84 100644 --- a/subjects/displayfile.md +++ b/subjects/displayfile.md @@ -9,8 +9,8 @@ Write a program that displays, on the standard output, only the content of the f - The argument of the program should be the name of the file, in this case, `quest8.txt`. - In case of error it should print: - - `File name missing`. - - `Too many arguments`. + - `File name missing`. + - `Too many arguments`. ### Output: diff --git a/subjects/displayz.md b/subjects/displayz.md index 8bc3172e..c884bd6b 100644 --- a/subjects/displayz.md +++ b/subjects/displayz.md @@ -19,4 +19,4 @@ student@ubuntu:~/piscine/test$ ./test "nbz" z student@ubuntu:~/piscine/test$ ./test z -``` \ No newline at end of file +``` diff --git a/subjects/enigma.md b/subjects/enigma.md index df2107c1..45cdb9cb 100644 --- a/subjects/enigma.md +++ b/subjects/enigma.md @@ -1,4 +1,5 @@ ## enigma + ### Instructions Write a function called `Enigma` that receives poiters to functions and move its values around to hide them @@ -11,9 +12,8 @@ This function must have the following signature. ```go func Enigma(a ***int, b *int, c *******int, d ****int) { - -} +} ``` ### Usage @@ -24,8 +24,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -82,5 +82,5 @@ After using Enigma 6 5 7 -student@ubuntu:~/student/enigma$ +student@ubuntu:~/student/enigma$ ``` diff --git a/subjects/firstword.md b/subjects/firstword.md index 3b5fd0f7..d704bbbd 100644 --- a/subjects/firstword.md +++ b/subjects/firstword.md @@ -22,5 +22,5 @@ student@ubuntu:~/piscine/test$ ./test student@ubuntu:~/piscine/test$ ./test "hello" "there" -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/fixthemain.md b/subjects/fixthemain.md index 3c843d68..158edc10 100644 --- a/subjects/fixthemain.md +++ b/subjects/fixthemain.md @@ -1,4 +1,4 @@ -## Fix the Main +## Fix the Main ### Instructions @@ -29,6 +29,7 @@ func IsDoorClose(ptrDoor *Door) bool { PutStr("Door is close ?") } ``` + ### Usage Here is a possible [program](TODO-LINK) to test your function : diff --git a/subjects/hello.md b/subjects/hello.md index 762f1d3b..6031385e 100644 --- a/subjects/hello.md +++ b/subjects/hello.md @@ -13,4 +13,4 @@ student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test Hello World! student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/inter.md b/subjects/inter.md index a77623d3..daf9625f 100644 --- a/subjects/inter.md +++ b/subjects/inter.md @@ -2,7 +2,6 @@ ### Instructions - Write a program that takes two strings and displays, without doubles, the characters that appear in both strings, in the order they appear in the first one. - The display will be followed by a `\n`. @@ -17,5 +16,5 @@ student@ubuntu:~/piscine/test$ ./test "padinton" "paqefwtdjetyiytjneytjoeyjnejey padinto student@ubuntu:~/piscine/test$ ./test ddf6vewg64f twthgdwthdwfteewhrtag6h4ffdhsd df6ewg4 -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/join.md b/subjects/join.md index d5745b61..2c88c853 100644 --- a/subjects/join.md +++ b/subjects/join.md @@ -1,4 +1,5 @@ ## join + ### Instructions Write a function, Join, that returns the elements of a slice strings (arstr) join together in one string. Using the string 'sep' as a separator between each element of the array @@ -8,11 +9,9 @@ The function must have the next signature. ### Expected function ```go - func Join(arstr []string, sep string) string { } - ``` ### Usage @@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -40,5 +39,5 @@ And its output : student@ubuntu:~/student/join$ go build student@ubuntu:~/student/join$ ./join hello--how--are--you -student@ubuntu:~/student/join$ +student@ubuntu:~/student/join$ ``` diff --git a/subjects/lastword.md b/subjects/lastword.md index fb5a6145..c1a68ead 100644 --- a/subjects/lastword.md +++ b/subjects/lastword.md @@ -1,4 +1,5 @@ ## lastword + ### Instructions Write a program that takes a string and displays its last word, followed by a diff --git a/subjects/listat.md b/subjects/listat.md index 83416cbc..f71b4a60 100644 --- a/subjects/listat.md +++ b/subjects/listat.md @@ -4,7 +4,7 @@ Write a function `ListAt` that haves one pointer to the list, `l`, and an `int` as parameters. This function should print a `Node` of the linked list, depending on the number, `nbr`. -- In case of error it should print `nil` +- In case of error it should print `nil` ### Expected function and structure @@ -46,7 +46,6 @@ func main() { fmt.Println(ListAt(link, 1).Data) fmt.Println(ListAt(link, 7)) } - ``` And its output : diff --git a/subjects/listclear.md b/subjects/listclear.md index 0e57b258..5c059197 100644 --- a/subjects/listclear.md +++ b/subjects/listclear.md @@ -4,7 +4,7 @@ Write a function `ListClear` that delets all `nodes` from a linked list, deleting the link between the list. -- Tip: assign the list's pointer to nil +- Tip: assign the list's pointer to nil ### Expected function and structure @@ -62,7 +62,6 @@ func main() { fmt.Println("------updated list------") PrintList(link) } - ``` And its output : diff --git a/subjects/listfind.md b/subjects/listfind.md index a22d3075..e4023cff 100644 --- a/subjects/listfind.md +++ b/subjects/listfind.md @@ -49,7 +49,7 @@ func main() { piscine.ListPushBack(link, "hello") piscine.ListPushBack(link, "hello2") piscine.ListPushBack(link, "hello3") - + fmt.Println(piscine.ListFind(link, CompStr)) } ``` diff --git a/subjects/listforeachif.md b/subjects/listforeachif.md index cd5b146f..81589024 100644 --- a/subjects/listforeachif.md +++ b/subjects/listforeachif.md @@ -2,7 +2,7 @@ ### Instructions -Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list. +Write a function `ListForEachIf` that applies a function given as argument to the information within some links of the list. - For this you will have to create a function `CompStr`, that returns a `bool`, to compare each elemente of the linked list, to see if it is a string, and than apply the function in the argument of `ListForEachIf`. @@ -62,6 +62,7 @@ func PrintList(l *list) { fmt.Print(l.tail) } + func main() { link := &list{} diff --git a/subjects/listlast.md b/subjects/listlast.md index 24503898..c53d4df8 100644 --- a/subjects/listlast.md +++ b/subjects/listlast.md @@ -18,6 +18,7 @@ type List struct { } func ListLast(l *list) *list { + } ``` @@ -33,7 +34,6 @@ import ( piscine ".." ) - func main() { link := &list{} link2 := &list{} @@ -45,7 +45,6 @@ func main() { fmt.Println(piscine.ListLast(link).head) fmt.Println(piscine.ListLast(link2).head) } - ``` And its output : diff --git a/subjects/listmerge.md b/subjects/listmerge.md index dc8e1360..49cafa93 100644 --- a/subjects/listmerge.md +++ b/subjects/listmerge.md @@ -22,7 +22,7 @@ type List struct { } func listMerge(l1 *List, l2 *List) { - + } ``` diff --git a/subjects/listpushback.md b/subjects/listpushback.md index 8eaeb190..eada7bf9 100644 --- a/subjects/listpushback.md +++ b/subjects/listpushback.md @@ -34,7 +34,7 @@ import ( ) func main() { - + link := &List{} piscine.ListPushBack(link, "Hello") diff --git a/subjects/listpushfront.md b/subjects/listpushfront.md index 8b1f6832..5ef0ea07 100644 --- a/subjects/listpushfront.md +++ b/subjects/listpushfront.md @@ -18,6 +18,7 @@ type List struct { } func ListPushFront(l *list, data interface{}) { + } ``` @@ -34,7 +35,6 @@ import ( ) func main() { - link := &list{} piscine.ListPushFront(link, "Hello") diff --git a/subjects/listpushpara.md b/subjects/listpushpara.md index d7eca8f4..08520796 100644 --- a/subjects/listpushpara.md +++ b/subjects/listpushpara.md @@ -1,19 +1,17 @@ -## listpushback +## listpushpara ### Instructions Write a program that creates a new linked list and includes each command-line argument in to the list. -- The first argument should be at the end of the list - -``` +- The first argument should be at the end of the list And its output : ```console student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./listpushparams choumi is the best cat -cat +cat best the is diff --git a/subjects/listremoveif.md b/subjects/listremoveif.md index 4d761f56..04ee54ab 100644 --- a/subjects/listremoveif.md +++ b/subjects/listremoveif.md @@ -6,7 +6,6 @@ Write a function `ListRemoveIf` that removes all elements that are equal to the - Use pointers wen ever you can. - ### Expected function and structure ```go @@ -80,7 +79,6 @@ func main() { fmt.Println("------answer-----") PrintList(link) } - ``` And its output : diff --git a/subjects/listreverse.md b/subjects/listreverse.md index 68aaf79c..0ca64fc0 100644 --- a/subjects/listreverse.md +++ b/subjects/listreverse.md @@ -4,7 +4,7 @@ Write a function `ListReverse` that reverses the elements order of a given linked list. -- Use pointers when ever you can +- Use pointers when ever you can ### Expected function and structure diff --git a/subjects/listsize.md b/subjects/listsize.md index 1dc61f57..2b48b3f8 100644 --- a/subjects/listsize.md +++ b/subjects/listsize.md @@ -18,7 +18,7 @@ type List struct { } func ListSize(l *List) int { - + } ``` @@ -44,7 +44,6 @@ func main() { fmt.Println(piscine.ListSize(link)) } - ``` And its output : diff --git a/subjects/listsort.md b/subjects/listsort.md index e5b0cd6c..09401c9b 100644 --- a/subjects/listsort.md +++ b/subjects/listsort.md @@ -4,7 +4,7 @@ Write a function `ListSort` that sorts the linked list by ascending order. -- This time you only will have the `Nodee` structure. +- This time you only will have the `Nodee` structure. - Try to use recursive. @@ -76,9 +76,7 @@ func main() { listPushBack(link, 1) PrintList(student.ListSort(link)) - } - ``` And its output : diff --git a/subjects/max.md b/subjects/max.md index 184d9686..5b664526 100644 --- a/subjects/max.md +++ b/subjects/max.md @@ -1,4 +1,5 @@ ## max + ### Instructions Write a function, Max, that returns the maximum value in a slice of integers @@ -8,11 +9,9 @@ The function must have the next signature. ### Expected function ```go - func Max(arr []int) int { } - ``` ### Usage @@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -40,5 +39,5 @@ And its output : student@ubuntu:~/student/max$ go build student@ubuntu:~/student/max$ ./max 123 -student@ubuntu:~/student/max$ +student@ubuntu:~/student/max$ ``` diff --git a/subjects/onlya.md b/subjects/onlya.md index b7e524b4..0c7ef855 100644 --- a/subjects/onlya.md +++ b/subjects/onlya.md @@ -2,4 +2,4 @@ ### Instructions -Write a program that displays a 'a' character on the standard output. \ No newline at end of file +Write a program that displays a 'a' character on the standard output. diff --git a/subjects/onlyz.md b/subjects/onlyz.md index 3cb74f4a..23f0e34b 100644 --- a/subjects/onlyz.md +++ b/subjects/onlyz.md @@ -1,4 +1,5 @@ ## displayalpham + ### Instructions -Write a program that displays a 'z' character on the standard output. \ No newline at end of file +Write a program that displays a 'z' character on the standard output. diff --git a/subjects/pilot.md b/subjects/pilot.md index d4fa97b2..1aa95a38 100644 --- a/subjects/pilot.md +++ b/subjects/pilot.md @@ -1,4 +1,5 @@ ## pilot + ### Instructions Write a go file so that the following program compile @@ -9,8 +10,8 @@ Write a go file so that the following program compile package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -23,4 +24,3 @@ func main() { fmt.Println(donnie) } ``` - diff --git a/subjects/point.md b/subjects/point.md index fe66243e..ba6b426e 100644 --- a/subjects/point.md +++ b/subjects/point.md @@ -1,4 +1,4 @@ - # Point +## Point ### Instructions @@ -6,21 +6,19 @@ Create a `.go` file and copy the code below into our file - The main task is to return a working program. -- - ```go func setPoint(ptr *point) { - ptr.x = 42 - ptr.y = 21 + ptr.x = 42 + ptr.y = 21 } func main() { - points := &point{} + points := &point{} + + setPoint(points) - setPoint(points) - - fmt.Printf("x = %d, y = %d",points.x, points.y) - fmt.Println() + fmt.Printf("x = %d, y = %d",points.x, points.y) + fmt.Println() } ``` @@ -29,6 +27,6 @@ func main() { ```console student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test -x = 42, y = 21 +x = 42, y = 21 student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +``` diff --git a/subjects/rectangle.md b/subjects/rectangle.md index c4e1c8f3..f3ba2df1 100644 --- a/subjects/rectangle.md +++ b/subjects/rectangle.md @@ -13,29 +13,29 @@ is defined by the points of the upper left and lower right corners. - Our main task is to make a program that: - - Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle` + - Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle` - - And calculates and prints the area of that rectangle you define. + - And calculates and prints the area of that rectangle you define. ### Expected main and function for the program ```go func defineRectangle(ptr *point, n int) *rectangle { - //complete here + } func calArea(ptr *rectangle) int { - //complete here + } func main() { - vPoint := []point{} + vPoint := []point{} rectangle := &rectangle{} n := 7 for i := 0; i < n; i++ { val := point{ - x: i%2 + 1, + x: i%2 + 1, y: i + 2, } vPoint = append(vPoint, val) @@ -45,7 +45,6 @@ func main() { } ``` - ### Expected output ```console diff --git a/subjects/repeatalpha.md b/subjects/repeatalpha.md index a095f69f..558123b9 100644 --- a/subjects/repeatalpha.md +++ b/subjects/repeatalpha.md @@ -1,11 +1,12 @@ ## repeatalpha + ### Instructions Write a program called repeat_alpha that takes a string and display it repeating each alphabetical character as many times as its alphabetical index, followed by a newline. -'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc... +`'a'` becomes `'a'`, `'b'` becomes `'bb'`, `'e'` becomes `'eeeee'`, etc... Case remains unchanged. @@ -25,5 +26,5 @@ student@ubuntu:~/student/repeatalpha$ ./repeatalpha | cat -e $ student@ubuntu:~/student/repeatalpha$ ./repeatalpha "" | cat -e $ -student@ubuntu:~/student/repeatalpha$ +student@ubuntu:~/student/repeatalpha$ ``` diff --git a/subjects/reversebits.md b/subjects/reversebits.md index e135d5fc..2234658b 100644 --- a/subjects/reversebits.md +++ b/subjects/reversebits.md @@ -1,4 +1,5 @@ ## reversebits + ### Instructions Write a function that takes a byte, reverses it, bit by bit (like the @@ -6,15 +7,20 @@ example) and returns the result. Your function must be declared as follows: +```go func ReverseBits(octet byte) byte { - ... + } +``` Example: - 1 byte -_____________ - 00100110 - || - \/ - 01100100 +1 byte + +--- +``` +00100110 + || + \/ +01100100 +``` diff --git a/subjects/rot13.md b/subjects/rot13.md index f4f0ac15..56619229 100644 --- a/subjects/rot13.md +++ b/subjects/rot13.md @@ -21,5 +21,5 @@ student@ubuntu:~/piscine/test$ ./test "hello there" uryyb gurer student@ubuntu:~/piscine/test$ ./test -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/rot14.md b/subjects/rot14.md index dcf010c7..ca3fe12b 100644 --- a/subjects/rot14.md +++ b/subjects/rot14.md @@ -13,6 +13,7 @@ func rot14(str string) string { } ``` + ### Usage Here is a possible [program](TODO-LINK) to test your function : @@ -33,7 +34,6 @@ func main() { } z01.PrintRune('\n') } - ``` And its output : diff --git a/subjects/searchreplace.md b/subjects/searchreplace.md index ee446b0a..861667ad 100644 --- a/subjects/searchreplace.md +++ b/subjects/searchreplace.md @@ -2,7 +2,7 @@ ### Instructions -Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument). +Write a program that takes 3 arguments, the first arguments is a string in which to replace a letter (2nd argument) by another one (3rd argument). - If the number of arguments is not 3, just display a newline. @@ -18,5 +18,5 @@ student@ubuntu:~/piscine/test$ ./test "abcd" "z" "l" abcd student@ubuntu:~/piscine/test$ ./test "something" "a" "o" "b" "c" -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/sortlistinsert.md b/subjects/sortlistinsert.md index a300b1ce..09340e70 100644 --- a/subjects/sortlistinsert.md +++ b/subjects/sortlistinsert.md @@ -4,7 +4,7 @@ Write a function `SortListInsert` that inserts `Data_ref` in the linked list, but it as to remain sorted in ascending order. -- The list as to be alredy sorted. +- The list as to be alredy sorted. - Use pointers when ever you can. @@ -43,6 +43,7 @@ func PrintList(l *Nodee) { fmt.Print(nil) fmt.Println() } + //insert elements func listPushBack(l *Nodee, Data int) { n := &Nodee{} @@ -73,7 +74,6 @@ func main() { link = sortListInsert(link, 2) PrintList(link) } - ``` And its output : diff --git a/subjects/strlen.md b/subjects/strlen.md index 0ff967b2..f129f9f6 100644 --- a/subjects/strlen.md +++ b/subjects/strlen.md @@ -4,7 +4,7 @@ Write a function that returns the length of a string. - - `len` is forbidden +- `len` is forbidden ### Expected function and structure diff --git a/subjects/swapbits.md b/subjects/swapbits.md index 32e9892b..60f49f08 100644 --- a/subjects/swapbits.md +++ b/subjects/swapbits.md @@ -1,4 +1,5 @@ ## swapbits + ### Instructions Write a function that takes a byte, swaps its halves (like the example) and @@ -6,15 +7,21 @@ returns the result. Your function must be declared as follows: +```go func SwapBits(octet byte) byte { - ... + } +``` Example: - 1 byte -_____________ - 0100 | 0001 - \ / - / \ - 0001 | 0100 \ No newline at end of file +1 byte + +--- + +``` +0100 | 0001 + \ / + / \ +0001 | 0100 +```` diff --git a/subjects/switchcase.md b/subjects/switchcase.md index 0afa2843..ef836406 100644 --- a/subjects/switchcase.md +++ b/subjects/switchcase.md @@ -2,7 +2,7 @@ ### Instructions -Write a program that takes a string and reverses the case of all its letters. +Write a program that takes a string and reverses the case of all its letters. - Other characters remain unchanged. @@ -16,7 +16,7 @@ Write a program that takes a string and reverses the case of all its letters. student@ubuntu:~/piscine/test$ go build student@ubuntu:~/piscine/test$ ./test "SometHingS iS WronG" sOMEThINGs Is wRONg -student@ubuntu:~/piscine/test$ ./test +student@ubuntu:~/piscine/test$ ./test -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/union.md b/subjects/union.md index c6f0afcc..6348bc42 100644 --- a/subjects/union.md +++ b/subjects/union.md @@ -1,4 +1,5 @@ ## union + ### Instructions Write a program that takes two strings and displays, without doubles, the diff --git a/subjects/unmatch.md b/subjects/unmatch.md index 8728f188..b8ce76e7 100644 --- a/subjects/unmatch.md +++ b/subjects/unmatch.md @@ -1,4 +1,5 @@ ## join + ### Instructions Write a function, Unmatch, that returns the element of the slice (arr) that does not have a correspondent pair. @@ -8,11 +9,9 @@ The function must have the next signature. ### Expected function ```go - func Unmatch(arr []int) int { } - ``` ### Usage @@ -23,8 +22,8 @@ Here is a possible [program](TODO-LINK) to test your function : package main import ( - "fmt" - student ".." + "fmt" + student ".." ) func main() { @@ -40,5 +39,5 @@ And its output : student@ubuntu:~/student/unmatch$ go build student@ubuntu:~/student/unmatch$ ./unmatch 4 -student@ubuntu:~/student/unmatch$ +student@ubuntu:~/student/unmatch$ ``` diff --git a/subjects/wdmatch.md b/subjects/wdmatch.md index 22462de7..a0fa68a8 100644 --- a/subjects/wdmatch.md +++ b/subjects/wdmatch.md @@ -2,7 +2,6 @@ ### Instructions - Write a program that takes two strings and checks whether it's possible to write the first string with characters from the second string, while respecting the order in which these characters appear in the second string. - If it's possible, the program displays the string followed by a `\n`, otherwise it simply displays a `\n`. @@ -21,5 +20,5 @@ student@ubuntu:~/piscine/test$ ./test "error" student@ubuntu:~/piscine/test$ ./test -student@ubuntu:~/piscine/test$ -``` \ No newline at end of file +student@ubuntu:~/piscine/test$ +``` diff --git a/subjects/ztail.md b/subjects/ztail.md index dc7471e1..015a9c5d 100644 --- a/subjects/ztail.md +++ b/subjects/ztail.md @@ -1,4 +1,5 @@ ## ztail + ### Instructions Write a program called ztail that does the same thing as the system command tail, but witch takes at least one file as argument. @@ -10,4 +11,3 @@ For this program you can use the "os" package. For the program to pass the test you should follow the convention for the return code of program in Unix sistems (see os.Exit) For more information consult the man page for tail. -