Browse Source

docs(reverseSecondHalf): fix subject

- fix indentation
- fixed console output
DEV-4017-prototypes-exercise-1-animals
jotapero 2 years ago committed by José Rosendo
parent
commit
3a26f0a94c
  1. 27
      subjects/reversesecondhalf/README.md

27
subjects/reversesecondhalf/README.md

@ -1,9 +1,9 @@
# reversesecondhalf
## reversesecondhalf
### Instructions
Write a function `ReverseSecondHalf()` that takes a string as an argument and prints the second half reversed. If the length of the string is odd, round it up.
Write a function that takes a `string` as an argument and prints the second half reversed. If the length of the string is odd, round it up.
- Prints the second half reversed followed by newline `\n`.
- Print the second half reversed followed by newline `\n`.
- If the string is empty, return `Invalid Output`.
- If the string's length equals one, return it, followed by newline `\n`.
@ -11,12 +11,13 @@ Write a function `ReverseSecondHalf()` that takes a string as an argument and pr
```go
func ReverseSecondHalf(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
@ -24,18 +25,18 @@ package main
import "fmt"
func main() {
fmt.Print(ReverseSecondHalf("This is the 1st half This is the 2nd half"))
fmt.Print(ReverseSecondHalf(""))
fmt.Print(ReverseSecondHalf("Hello World"))
fmt.Print(ReverseSecondHalf("This is the 1st half This is the 2nd half"))
fmt.Print(ReverseSecondHalf(""))
fmt.Print(ReverseSecondHalf("Hello World"))
}
```
And its output :
And its output:
```go
```console
$ go run . | cat -e
flah dn2 eht si sihT$
Invalid Output$
dlroW$
flah dn2 eht si sihT
Invalid Output
dlroW
$
```

Loading…
Cancel
Save