forked from root/public
estlop
2 years ago
committed by
Dav Hojt
1 changed files with 38 additions and 0 deletions
@ -0,0 +1,38 @@ |
|||||||
|
## oddlength |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a function that receives a slice of strings and returns a new slice with the strings in which the length is odd. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func Oddlength(strings []string) []string { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"piscine" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
l := piscine.Oddlength(["Hi", "Hola", "Ola", "Ciao", "Salut", "Hallo"]) |
||||||
|
fmt.Println(l) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . |
||||||
|
[Ola Salut Hallo] |
||||||
|
``` |
Loading…
Reference in new issue