mirror of https://github.com/01-edu/public.git
Browse Source
- moved README.md to correct directory - fixed grammar and added test casespull/1622/head
jrosendo
2 years ago
committed by
José Rosendo
2 changed files with 46 additions and 35 deletions
@ -1,35 +0,0 @@ |
|||||||
## byebyefirst |
|
||||||
|
|
||||||
### Instructions |
|
||||||
|
|
||||||
Write a function that takes a slice of strings and returns a new slice without the first element. If the slice is empty, return the empty slice. |
|
||||||
|
|
||||||
### Expected function |
|
||||||
|
|
||||||
```go |
|
||||||
func ByeByeFirst(strings []string) []string { |
|
||||||
} |
|
||||||
``` |
|
||||||
|
|
||||||
### Usage |
|
||||||
|
|
||||||
Here is a possible program to test your function : |
|
||||||
|
|
||||||
```go |
|
||||||
package main |
|
||||||
|
|
||||||
func main() { |
|
||||||
fmt.Println(ByeByeFirst([]string{})) |
|
||||||
fmt.Println(ByeByeFirst([]string{"first", "second"})) |
|
||||||
fmt.Println(ByeByeFirst([]string{"", "abcd", "efg"})) |
|
||||||
} |
|
||||||
``` |
|
||||||
|
|
||||||
And its output : |
|
||||||
|
|
||||||
```console |
|
||||||
$ go run . | cat -e |
|
||||||
[]$ |
|
||||||
[second]$ |
|
||||||
[abcd efg]$ |
|
||||||
``` |
|
@ -0,0 +1,46 @@ |
|||||||
|
## byebyefirst |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a function that takes a slice of `string` and returns a new slice without the first element. |
||||||
|
|
||||||
|
- If the slice is empty, return the empty slice. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func ByeByeFirst(strings []string) []string { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
|
||||||
|
"piscine" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
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"})) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . | cat -e |
||||||
|
[]$ |
||||||
|
[]$ |
||||||
|
[second]$ |
||||||
|
[abcd efg]$ |
||||||
|
``` |
Loading…
Reference in new issue