Browse Source

fix(checkpoints) add imports to the files

pull/2433/head
miguel 10 months ago committed by MSilva95
parent
commit
7b50c69f22
  1. 9
      subjects/byebyefirst/main.go
  2. 13
      subjects/cameltosnakecase/main.go
  3. 5
      subjects/checknumber/main.go
  4. 14
      subjects/chunk/main.go
  5. 9
      subjects/concatalternate/main.go
  6. 7
      subjects/countalpha/main.go
  7. 9
      subjects/countcharacter/main.go
  8. 9
      subjects/digitlen/main.go
  9. 9
      subjects/findprevprime/main.go
  10. 17
      subjects/foldint/main.go
  11. 5
      subjects/halfslice/main.go
  12. 9
      subjects/hashcode/main.go
  13. 13
      subjects/iscapitalized/main.go
  14. 9
      subjects/listremoveif/main.go
  15. 17
      subjects/notdecimal/main.go
  16. 9
      subjects/printif/main.go
  17. 9
      subjects/printifnot/main.go
  18. 7
      subjects/rectperimeter/main.go
  19. 10
      subjects/reduceint/main.go
  20. 7
      subjects/removeduplicate/main.go
  21. 7
      subjects/reversesecondhalf/main.go
  22. 4
      subjects/reversestrings/README.md
  23. 7
      subjects/swapfirst/main.go
  24. 7
      subjects/swaplast/main.go
  25. 9
      subjects/thirdtimeisacharm/main.go
  26. 7
      subjects/weareunique/main.go
  27. 7
      subjects/zipstring/main.go

9
subjects/byebyefirst/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(ByeByeFirst([]string{}))
fmt.Println(ByeByeFirst([]string{"one arg"}))
fmt.Println(ByeByeFirst([]string{"first", "second"}))
fmt.Println(ByeByeFirst([]string{"", "abcd", "efg"}))
fmt.Println(piscine.ByeByeFirst([]string{}))
fmt.Println(piscine.ByeByeFirst([]string{"one arg"}))
fmt.Println(piscine.ByeByeFirst([]string{"first", "second"}))
fmt.Println(piscine.ByeByeFirst([]string{"", "abcd", "efg"}))
}

13
subjects/cameltosnakecase/main.go

@ -2,13 +2,14 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(CamelToSnakeCase("HelloWorld"))
fmt.Println(CamelToSnakeCase("helloWorld"))
fmt.Println(CamelToSnakeCase("camelCase"))
fmt.Println(CamelToSnakeCase("CAMELtoSnackCASE"))
fmt.Println(CamelToSnakeCase("camelToSnakeCase"))
fmt.Println(CamelToSnakeCase("hey2"))
fmt.Println(piscine.CamelToSnakeCase("HelloWorld"))
fmt.Println(piscine.CamelToSnakeCase("helloWorld"))
fmt.Println(piscine.CamelToSnakeCase("camelCase"))
fmt.Println(piscine.CamelToSnakeCase("CAMELtoSnackCASE"))
fmt.Println(piscine.CamelToSnakeCase("camelToSnakeCase"))
fmt.Println(piscine.CamelToSnakeCase("hey2"))
}

5
subjects/checknumber/main.go

@ -2,9 +2,10 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(CheckNumber("Hello"))
fmt.Println(CheckNumber("Hello1"))
fmt.Println(piscine.CheckNumber("Hello"))
fmt.Println(piscine.CheckNumber("Hello1"))
}

14
subjects/chunk/main.go

@ -1,9 +1,13 @@
package main
import (
"piscine"
)
func main() {
Chunk([]int{}, 10)
Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 0)
Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 3)
Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 5)
Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 4)
piscine.Chunk([]int{}, 10)
piscine.Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 0)
piscine.Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 3)
piscine.Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 5)
piscine.Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 4)
}

9
subjects/concatalternate/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(ConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6}))
fmt.Println(ConcatAlternate([]int{2, 4, 6, 8, 10}, []int{1, 3, 5, 7, 9, 11}))
fmt.Println(ConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6, 7, 8, 9}))
fmt.Println(ConcatAlternate([]int{1, 2, 3}, []int{}))
fmt.Println(piscine.ConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6}))
fmt.Println(piscine.ConcatAlternate([]int{2, 4, 6, 8, 10}, []int{1, 3, 5, 7, 9, 11}))
fmt.Println(piscine.ConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6, 7, 8, 9}))
fmt.Println(piscine.ConcatAlternate([]int{1, 2, 3}, []int{}))
}

7
subjects/countalpha/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(CountAlpha("Hello world"))
fmt.Println(CountAlpha("H e l l o"))
fmt.Println(CountAlpha("H1e2l3l4o"))
fmt.Println(piscine.CountAlpha("Hello world"))
fmt.Println(piscine.CountAlpha("H e l l o"))
fmt.Println(piscine.CountAlpha("H1e2l3l4o"))
}

9
subjects/countcharacter/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(CountChar("Hello World", 'l'))
fmt.Println(CountChar("5 balloons", 5))
fmt.Println(CountChar(" ", ' '))
fmt.Println(CountChar("The 7 deadly sins", '7'))
fmt.Println(piscine.CountChar("Hello World", 'l'))
fmt.Println(piscine.CountChar("5 balloons", 5))
fmt.Println(piscine.CountChar(" ", ' '))
fmt.Println(piscine.CountChar("The 7 deadly sins", '7'))
}

9
subjects/digitlen/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(DigitLen(100, 10))
fmt.Println(DigitLen(100, 2))
fmt.Println(DigitLen(-100, 16))
fmt.Println(DigitLen(100, -1))
fmt.Println(piscine.DigitLen(100, 10))
fmt.Println(piscine.DigitLen(100, 2))
fmt.Println(piscine.DigitLen(-100, 16))
fmt.Println(piscine.DigitLen(100, -1))
}

9
subjects/findprevprime/main.go

@ -1,8 +1,11 @@
package main
import "fmt"
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(FindPrevPrime(5))
fmt.Println(FindPrevPrime(4))
fmt.Println(piscine.FindPrevPrime(5))
fmt.Println(piscine.FindPrevPrime(4))
}

17
subjects/foldint/main.go

@ -1,17 +1,20 @@
package main
import "fmt"
import (
"fmt"
"piscine"
)
func main() {
table := []int{1, 2, 3}
ac := 93
FoldInt(Add, table, ac)
FoldInt(Mul, table, ac)
FoldInt(Sub, table, ac)
piscine.FoldInt(Add, table, ac)
piscine.FoldInt(Mul, table, ac)
piscine.FoldInt(Sub, table, ac)
fmt.Println()
table = []int{0}
FoldInt(Add, table, ac)
FoldInt(Mul, table, ac)
FoldInt(Sub, table, ac)
piscine.FoldInt(Add, table, ac)
piscine.FoldInt(Mul, table, ac)
piscine.FoldInt(Sub, table, ac)
}

5
subjects/halfslice/main.go

@ -2,9 +2,10 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(HalfSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(HalfSlice([]int{1, 2, 3}))
fmt.Println(piscine.HalfSlice([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(piscine.HalfSlice([]int{1, 2, 3}))
}

9
subjects/hashcode/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(HashCode("A"))
fmt.Println(HashCode("AB"))
fmt.Println(HashCode("BAC"))
fmt.Println(HashCode("Hello World"))
fmt.Println(piscine.HashCode("A"))
fmt.Println(piscine.HashCode("AB"))
fmt.Println(piscine.HashCode("BAC"))
fmt.Println(piscine.HashCode("Hello World"))
}

13
subjects/iscapitalized/main.go

@ -2,13 +2,14 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(IsCapitalized("Hello! How are you?"))
fmt.Println(IsCapitalized("Hello How Are You"))
fmt.Println(IsCapitalized("Whats 4this 100K?"))
fmt.Println(IsCapitalized("Whatsthis4"))
fmt.Println(IsCapitalized("!!!!Whatsthis4"))
fmt.Println(IsCapitalized(""))
fmt.Println(piscine.IsCapitalized("Hello! How are you?"))
fmt.Println(piscine.IsCapitalized("Hello How Are You"))
fmt.Println(piscine.IsCapitalized("Whats 4this 100K?"))
fmt.Println(piscine.IsCapitalized("Whatsthis4"))
fmt.Println(piscine.IsCapitalized("!!!!Whatsthis4"))
fmt.Println(piscine.IsCapitalized(""))
}

9
subjects/listremoveif/main.go

@ -1,6 +1,9 @@
package main
import "fmt"
import (
"fmt"
"piscine"
)
func PrintList(l *List) {
it := l.Head
@ -19,7 +22,7 @@ func main() {
fmt.Println("----normal state----")
ListPushBack(link2, 1)
PrintList(link2)
ListRemoveIf(link2, 1)
piscine.ListRemoveIf(link2, 1)
fmt.Println("------answer-----")
PrintList(link2)
fmt.Println()
@ -38,7 +41,7 @@ func main() {
ListPushBack(link, 1)
PrintList(link)
ListRemoveIf(link, 1)
piscine.ListRemoveIf(link, 1)
fmt.Println("------answer-----")
PrintList(link)
}

17
subjects/notdecimal/main.go

@ -2,15 +2,16 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(NotDecimal("0.1"))
fmt.Print(NotDecimal("174.2"))
fmt.Print(NotDecimal("0.1255"))
fmt.Print(NotDecimal("1.20525856"))
fmt.Print(NotDecimal("-0.0f00d00"))
fmt.Print(NotDecimal(""))
fmt.Print(NotDecimal("-19.525856"))
fmt.Print(NotDecimal("1952"))
fmt.Print(piscine.NotDecimal("0.1"))
fmt.Print(piscine.NotDecimal("174.2"))
fmt.Print(piscine.NotDecimal("0.1255"))
fmt.Print(piscine.NotDecimal("1.20525856"))
fmt.Print(piscine.NotDecimal("-0.0f00d00"))
fmt.Print(piscine.NotDecimal(""))
fmt.Print(piscine.NotDecimal("-19.525856"))
fmt.Print(piscine.NotDecimal("1952"))
}

9
subjects/printif/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(PrintIf("abcdefz"))
fmt.Print(PrintIf("abc"))
fmt.Print(PrintIf(""))
fmt.Print(PrintIf("14"))
fmt.Print(piscine.PrintIf("abcdefz"))
fmt.Print(piscine.PrintIf("abc"))
fmt.Print(piscine.PrintIf(""))
fmt.Print(piscine.PrintIf("14"))
}

9
subjects/printifnot/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(PrintIfNot("abcdefz"))
fmt.Print(PrintIfNot("abc"))
fmt.Print(PrintIfNot(""))
fmt.Print(PrintIfNot("14"))
fmt.Print(piscine.PrintIfNot("abcdefz"))
fmt.Print(piscine.PrintIfNot("abc"))
fmt.Print(piscine.PrintIfNot(""))
fmt.Print(piscine.PrintIfNot("14"))
}

7
subjects/rectperimeter/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(RectPerimeter(10, 2))
fmt.Println(RectPerimeter(434343, 898989))
fmt.Println(RectPerimeter(10, -2))
fmt.Println(piscine.RectPerimeter(10, 2))
fmt.Println(piscine.RectPerimeter(434343, 898989))
fmt.Println(piscine.RectPerimeter(10, -2))
}

10
subjects/reduceint/main.go

@ -1,5 +1,9 @@
package main
import (
"piscine"
)
func main() {
mul := func(acc int, cur int) int {
return acc * cur
@ -11,7 +15,7 @@ func main() {
return acc / cur
}
as := []int{500, 2}
ReduceInt(as, mul)
ReduceInt(as, sum)
ReduceInt(as, div)
piscine.ReduceInt(as, mul)
piscine.ReduceInt(as, sum)
piscine.ReduceInt(as, div)
}

7
subjects/removeduplicate/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(RemoveDuplicate([]int{1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(RemoveDuplicate([]int{1, 1, 2, 2, 3}))
fmt.Println(RemoveDuplicate([]int{}))
fmt.Println(piscine.RemoveDuplicate([]int{1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(piscine.RemoveDuplicate([]int{1, 1, 2, 2, 3}))
fmt.Println(piscine.RemoveDuplicate([]int{}))
}

7
subjects/reversesecondhalf/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(ReverseSecondHalf("This is the 1st half This is the 2nd half"))
fmt.Print(ReverseSecondHalf(""))
fmt.Print(ReverseSecondHalf("Hello World"))
fmt.Print(piscine.ReverseSecondHalf("This is the 1st half This is the 2nd half"))
fmt.Print(piscine.ReverseSecondHalf(""))
fmt.Print(piscine.ReverseSecondHalf("Hello World"))
}

4
subjects/reversestrings/READMED.md → subjects/reversestrings/README.md

@ -16,7 +16,7 @@ func ReverseStrings(strs []string) string {
Here is a possible program to test your function:
```go
```go
package main
import "fmt"
@ -28,7 +28,7 @@ func main(){
}
```
And its output :
And its output :
```console
$ go run .

7
subjects/swapfirst/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(SwapFirst([]int{1, 2, 3, 4}))
fmt.Println(SwapFirst([]int{3, 4, 6}))
fmt.Println(SwapFirst([]int{1}))
fmt.Println(piscine.SwapFirst([]int{1, 2, 3, 4}))
fmt.Println(piscine.SwapFirst([]int{3, 4, 6}))
fmt.Println(piscine.SwapFirst([]int{1}))
}

7
subjects/swaplast/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(SwapLast([]int{1, 2, 3, 4}))
fmt.Println(SwapLast([]int{3, 4, 5}))
fmt.Println(SwapLast([]int{1}))
fmt.Println(piscine.SwapLast([]int{1, 2, 3, 4}))
fmt.Println(piscine.SwapLast([]int{3, 4, 5}))
fmt.Println(piscine.SwapLast([]int{1}))
}

9
subjects/thirdtimeisacharm/main.go

@ -2,11 +2,12 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(ThirdTimeIsACharm("123456789"))
fmt.Print(ThirdTimeIsACharm(""))
fmt.Print(ThirdTimeIsACharm("a b c d e f"))
fmt.Print(ThirdTimeIsACharm("12"))
fmt.Print(piscine.ThirdTimeIsACharm("123456789"))
fmt.Print(piscine.ThirdTimeIsACharm(""))
fmt.Print(piscine.ThirdTimeIsACharm("a b c d e f"))
fmt.Print(piscine.ThirdTimeIsACharm("12"))
}

7
subjects/weareunique/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(WeAreUnique("foo", "boo"))
fmt.Println(WeAreUnique("", ""))
fmt.Println(WeAreUnique("abc", "def"))
fmt.Println(piscine.WeAreUnique("foo", "boo"))
fmt.Println(piscine.WeAreUnique("", ""))
fmt.Println(piscine.WeAreUnique("abc", "def"))
}

7
subjects/zipstring/main.go

@ -2,10 +2,11 @@ package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(ZipString("YouuungFellllas"))
fmt.Println(ZipString("Thee quuick browwn fox juumps over the laaazy dog"))
fmt.Println(ZipString("Helloo Therre!"))
fmt.Println(piscine.ZipString("YouuungFellllas"))
fmt.Println(piscine.ZipString("Thee quuick browwn fox juumps over the laaazy dog"))
fmt.Println(piscine.ZipString("Helloo Therre!"))
}

Loading…
Cancel
Save