Kodewick
Start learning →
Basic←→0 / 70

Quiz results

#044BasicFunctionsLoops4 min

Write PassFail(scores) to count how many scores pass (60 or more) and how many fail. The results already have names, pass and fail, both starting at 0, and the bare return at the end hands them back.

Examples
PassFail([]int{75, 40, 60})→(2, 1)
PassFail([]int{})→(0, 0)
The functionfunc PassFail(scores []int) (pass, fail int)
main.go
package main

func PassFail(scores []int) (pass, fail int) {
	for _, s := range scores {
		// your code here: a pass adds 1 to pass, otherwise add 1 to fail
	}
	return
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.