Browse Source

DEV-3179-new-go-exercise-thirdtimeisacharm (#1355)

* feat: subject thisrtimeisacharm

* Update README.md

* Update README.md

* docs(thirthtimeischarm) : Fixe  mistakes after review

* docs(ThirdTimeIsACharm)  : removing space from main

* docs (ThirdTimeIsACharm) :  add a single quote

* Update README.md

* docs(thirdtimeisacharm): fix subject

- fix exercise header
- upgrade instructions
- add missing import 'piscine'
- fix console
- fix white-spaces and indentation

* docs(thirdtimeisthecharm): grammar fix

---------

Co-authored-by: Tiago Collot <collot.tiago1@gmail.com>
Co-authored-by: jrosendo <jose@01talent.com>
pull/1354/head
Zainab Dnaya 12 months ago committed by GitHub
parent
commit
2e792a7b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      subjects/thirdtimeisacharm/README.md

47
subjects/thirdtimeisacharm/README.md

@ -0,0 +1,47 @@
## thirdtimeisacharm
### Instructions
Write a function `ThirdTimeIsACharm()` that takes a `string` as an argument and returns another `string` with every third character.
- Return 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:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
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:
```console
$ go run . | cat -e
369$
$
b e$
$
```
Loading…
Cancel
Save