mirror of https://github.com/01-edu/public.git
Browse Source
* 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
1 changed files with 47 additions and 0 deletions
@ -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…
Reference in new issue