Compare commits

...

18 Commits

Author SHA1 Message Date
Tiago Collot b11261aa0f docs(printandmiss): fix instructions 2 years ago
Tiago Collot 9334182cca docs(printandmiss): fix subject 2 years ago
Tiago Collot 26674a1286 feat(printandmiss): upgrade feat 2 years ago
Tiago Collot 29cec306c1 style(printandmiss): formatting, white-space 2 years ago
zainab Dnaya 54f95c834e
docs(printandmis) : change a variable name 2 years ago
zainab Dnaya ba395843bd
correct the subject 2 years ago
zainab Dnaya d6f94d1ff8
docs(printandmiss) : replace Print with return 2 years ago
zainab Dnaya cbda8809fc
docs(printandmiss) : correct Typo 2 years ago
zainab Dnaya d26a81c6ae
docs(printandmis) : fixe some typo 2 years ago
zainab Dnaya dd351a16f8
Update README.md 2 years ago
zainab Dnaya 0a4927e4e0
Update README.md 2 years ago
zainab Dnaya 6603bda2da
Delete README.md 2 years ago
zainabdnaya 6883b5e7a4 PrinAndMiss 2 years ago
zainabdnaya 9088bd5741 PrinAndMiss 2 years ago
zainabdnaya 34823bc4d9 PrinAndMiss 2 years ago
zainabdnaya 4c2ef9eef2 PrinAndMiss 2 years ago
zainabdnaya 3309e89c4c fifthandskip 2 years ago
zainabdnaya 8af2146941 fifthandskip 2 years ago
  1. 49
      subjects/printandmiss/README.md

49
subjects/printandmiss/README.md

@ -0,0 +1,49 @@
## printandmiss
### Instructions
Write a function called `PrintAndMiss()` that takes a `string` and an `int` as an argument. The function should move through the `string` in sets determined by the `int`, printing the first set, omitting the second, printing the third, and so on, in a 'print' and 'miss' fashion until the end of the `string` is reached. Return a `string` containing the printed characters.
- If the `string` is empty or the `int` is negative return `Invalid Output` followed by newline `\n`.
- If the `int` is `0` return the `string` followed by a newline `\n`.
### Expected function
```go
func PrintAndMiss(arg string, num int) string {
}
```
### Usage
Here is a possible program to test your function:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(piscine.PrintAndMiss("123456789", 3))
fmt.Print(piscine.PrintAndMiss("abcdefghijklmnopqrstuvwyz", 3))
fmt.Print(piscine.PrintAndMiss("", 3))
fmt.Print(piscine.PrintAndMiss("hello you all ! ", 0))
fmt.Print(piscine.PrintAndMiss("what is your name?", 0))
fmt.Print(piscine.PrintAndMiss("go Exercise Print and Miss", -5))
}
```
And its output:
```console
$ go run . | cat -e
123789$
abcghimnostuz$
Invalid Output$
hello you all ! $
what is your name?$
Invalid Output$
```
Loading…
Cancel
Save