forked from root/public
Compare commits
2 Commits
master
...
1274-oddle
Author | SHA1 | Date |
---|---|---|
estlop | a4c4dee4a5 | 2 years ago |
estlop | 080a12cafe | 2 years ago |
1 changed files with 34 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||||||
|
## 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. When the slice is empty or there are no odd strings return an empty slice. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func Oddlength(strings []string) []string { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import "fmt" |
||||||
|
|
||||||
|
func main() { |
||||||
|
fmt.Println(Oddlength(["Hi", "Hola", "Ola", "Ciao", "Salut", "Hallo"])) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . |
||||||
|
[Ola Salut Hallo] |
||||||
|
``` |
Loading…
Reference in new issue