mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
616 B
33 lines
616 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
|
import (
|
||
5 years ago
|
"strings"
|
||
|
|
||
5 years ago
|
student "student"
|
||
|
|
||
|
"lib"
|
||
5 years ago
|
)
|
||
|
|
||
5 years ago
|
func join(elems []string, sep string) string {
|
||
|
return strings.Join(elems, sep)
|
||
|
}
|
||
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
seps := []string{" ", "-", " ,", "_", "SPC", " . "}
|
||
|
|
||
5 years ago
|
args := [][]string{
|
||
|
{"hello", "how", "are", "you", "doing"},
|
||
|
{"fine", "and", "you"},
|
||
|
{"I'm", "O.K."},
|
||
|
}
|
||
5 years ago
|
|
||
|
for i := 0; i < 5; i++ {
|
||
5 years ago
|
// random position for the slice of arguments
|
||
5 years ago
|
posA := lib.RandIntBetween(0, len(args)-1)
|
||
5 years ago
|
// random position for the slice of separators
|
||
5 years ago
|
posS := lib.RandIntBetween(0, len(seps)-1)
|
||
5 years ago
|
|
||
5 years ago
|
lib.Challenge("Join", student.Join, join, args[posA], seps[posS])
|
||
5 years ago
|
}
|
||
|
}
|