Browse Source

fix(go-exam): add missing import piscine, style: correct white-spaces and formatting

DEV-3177-new-go-exercise-fromto
Tiago Collot 2 years ago
parent
commit
fe0f3e0a3d
  1. 21
      subjects/fromto/README.md

21
subjects/fromto/README.md

@ -1,13 +1,13 @@
# fromto ## fromto
### Instructions ### Instructions
- Write a function that takes two `integers` and returns a `string` representing the range of numbers from the first to the second. - Write a function that takes two `integers` and returns a `string` representing the range of numbers from the first to the second.
- The function can return the numbers in any order. - The function can return the numbers in any order.
- The number must be separated by a comma and a space. - The number must be separated by a comma and a space.
- If any of the arguments is bigger than 99 or less than 0, the function returns `"invalid"` followed by a newline (`'\n'`). - If any of the arguments is bigger than 99 or less than 0, the function returns `"Invalid"` followed by a newline (`'\n'`).
- Add `0` at the first of any number if it is less than 10. - Add `0` at the first of any number if it is less than 10.
- Add a new line (`'\n'`) at the end of the string. - Add a new line (`'\n'`) at the end of the `string`.
### Expected function ### Expected function
```go ```go
@ -23,13 +23,16 @@ Here is a possible program to test your function:
```go ```go
package main package main
import "fmt" import (
"fmt"
"piscine"
)
func main() { func main() {
fmt.Print(FromTo(1, 10)) fmt.Print(piscine.FromTo(1, 10))
fmt.Print(FromTo(10, 1)) fmt.Print(piscine.FromTo(10, 1))
fmt.Print(FromTo(10, 10)) fmt.Print(piscine.FromTo(10, 10))
fmt.Print(FromTo(100, 10)) fmt.Print(piscine.FromTo(100, 10))
} }
``` ```
And its output: And its output:
@ -39,5 +42,5 @@ $ go run . | cat -e
01, 02, 03, 04, 05, 06, 07, 08, 09, 10$ 01, 02, 03, 04, 05, 06, 07, 08, 09, 10$
10, 09, 08, 07, 06, 05, 04, 03, 02, 01$ 10, 09, 08, 07, 06, 05, 04, 03, 02, 01$
10$ 10$
invalid$ Invalid$
``` ```

Loading…
Cancel
Save