|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
student "student"
|
|
|
|
|
|
|
|
"github.com/01-edu/public/go/tests/lib"
|
|
|
|
)
|
|
|
|
|
|
|
|
func join(elems []string, sep string) string {
|
|
|
|
return strings.Join(elems, sep)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
seps := []string{" ", "-", " ,", "_", "SPC", " . "}
|
|
|
|
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
args := [][]string{
|
|
|
|
{"hello", "how", "are", "you", "doing"},
|
|
|
|
{"fine", "and", "you"},
|
|
|
|
{"I'm", "O.K."},
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := 0; i < 5; i++ {
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
// random position for the slice of arguments
|
|
|
|
posA := lib.RandIntBetween(0, len(args)-1)
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
// random position for the slice of separators
|
|
|
|
posS := lib.RandIntBetween(0, len(seps)-1)
|
|
|
|
|
|
|
|
lib.Challenge("Join", student.Join, join, args[posA], seps[posS])
|
|
|
|
}
|
|
|
|
}
|