Kodewick
Start learning →
Mini challenge←→0 / 70

Report card

#010Mini challengeOutputLoops6 min

Lin's three test scores are in scores. Add them up into sum, work out the average (turn both numbers into float64 before dividing), then use one fmt.Printf to show Lin: [90 85 78] avg 84.33: the name with %s, the scores with %v, the average with %.2f.

Should show
Lin: [90 85 78] avg 84.33
main.go
package main

import "fmt"

func main() {
	name := "Lin"
	scores := []int{90, 85, 78}
	sum := 0
	// your code here: range over scores, adding each one to sum
	// your code here: work out avg, then fmt.Printf the line
}
Ctrl + Enter runs too
Result

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