Browse Source

docs(thirdtimeisacharm): fix subject

- fix exercise header
- upgrade instructions
- add missing import 'piscine'
- fix console
- fix white-spaces and indentation
DEV-3179-new-go-exercise-thirdtimeisacharm
Tiago Collot 2 years ago
parent
commit
f247c82851
  1. 30
      subjects/thirdtimeisacharm/README.md

30
subjects/thirdtimeisacharm/README.md

@ -1,40 +1,44 @@
# thirdtimeisacharm
## thirdtimeisacharm
### Instructions
Write a function `ThirdTimeIsACharm` that takes a string and returns another string with every third character.
Write a function `ThirdTimeIsACharm()` that takes a `string` as an argument and returns another `string` with every third character.
- Prints the output followed by newline `\n`.
- If the string is empty, return newline `\n`.
- If there is no third character, return newline `\n`.
- Prints the output followed by a newline `\n`.
- If the `string` is empty, return a newline `\n`.
- If there is no third character, return a newline `\n`.
### Expected function
```go
func ThirdTimeIsACharm(str string) string {
}
```
### Usage
Here is a possible program to test your function :
Here is a possible program to test your function:
```go
package main
import "fmt"
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(ThirdTimeIsACharm("123456789"))
fmt.Print(ThirdTimeIsACharm(""))
fmt.Print(ThirdTimeIsACharm("a b c d e f"))
fmt.Print(ThirdTimeIsACharm("12"))
fmt.Print(piscine.ThirdTimeIsACharm("123456789"))
fmt.Print(piscine.ThirdTimeIsACharm(""))
fmt.Print(piscine.ThirdTimeIsACharm("a b c d e f"))
fmt.Print(piscine.ThirdTimeIsACharm("12"))
}
```
And its output :
And its output:
```go
```console
$ go run . | cat -e
369$
$

Loading…
Cancel
Save