forked from root/public
Compare commits
8 Commits
master
...
1258-canyo
Author | SHA1 | Date |
---|---|---|
![]() |
5d30ccdb24 | 2 years ago |
![]() |
59641a6afd | 2 years ago |
![]() |
dfb2833658 | 2 years ago |
![]() |
a59acdbb2c | 2 years ago |
![]() |
062e2fd0ce | 2 years ago |
![]() |
a7520c4a72 | 2 years ago |
![]() |
381472716b | 2 years ago |
![]() |
82424c0cdb | 2 years ago |
2 changed files with 57 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||||||
|
## canyoucount |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Your program will receive some arguments. Count how many characters they have in total and print them. |
||||||
|
|
||||||
|
- If the number of arguments is invalid it should print `0`. |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . "hello" "how are you?" | cat -e |
||||||
|
17$ |
||||||
|
$ go run . "hi" | cat -e |
||||||
|
2$ |
||||||
|
$ go run . | cat -e |
||||||
|
0$ |
||||||
|
``` |
@ -0,0 +1,39 @@ |
|||||||
|
## popint |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a function that receives a slice of int and returns a new slice without the last element. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func PopInt(ints []int) []int { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"piscine" |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
ints := []int{6, 7, 8, 9,} |
||||||
|
l := piscine.PopInt(ints) |
||||||
|
fmt.Println(l) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . |
||||||
|
[6 7 8] |
||||||
|
``` |
Loading…
Reference in new issue