forked from root/public
Compare commits
3 Commits
master
...
1281-evenl
Author | SHA1 | Date |
---|---|---|
estlop | 124d3ad576 | 2 years ago |
estlop | 63f648c8d9 | 2 years ago |
estlop | 158ca1e7c0 | 2 years ago |
3 changed files with 38 additions and 29 deletions
@ -0,0 +1,33 @@
|
||||
## evenlength |
||||
|
||||
### Instructions |
||||
|
||||
Write a function that receives a slice of strings and returns a new slice with the strings in which the length is even. When the slice is empty or there are no even strings return an empty slice. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func EvenLength(strings []string) []string { |
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
package main |
||||
|
||||
import "fmt" |
||||
|
||||
func main() { |
||||
fmt.Println(EvenLength([]string{"Hi", "Hola", "Ola", "Ciao", "Salut", "Hallo"})) |
||||
} |
||||
``` |
||||
|
||||
And its output: |
||||
|
||||
```console |
||||
$ go run . |
||||
[Hi Hola Ciao] |
||||
``` |
@ -1,25 +0,0 @@
|
||||
## get-area |
||||
|
||||
### Instructions |
||||
|
||||
Write a program that takes a positive number as radius and prints the area of a circle. |
||||
- The area of the circle is `3.14` times the radius squared. |
||||
- Only positive numbers will be accepted, otherwise print `Error` followed by (`'\n'`) |
||||
- If the number of arguments is not `1` print (`'\n'`) |
||||
- The output must be an integer. |
||||
|
||||
|
||||
### Usage |
||||
|
||||
```console |
||||
$ go run . | cat -e |
||||
$ |
||||
$ go run . 10 | cat -e |
||||
314$ |
||||
$ go run . 4 | cat -e |
||||
50$ |
||||
$ go run . -10 | cat -e |
||||
Error$ |
||||
$ go run . "Hello World!" | cat -e |
||||
Error$ |
||||
``` |
Loading…
Reference in new issue