Drill

ProblemsGo › games

Count league points

easygamesMathGo

A sports league awards 3 points for a win and 1 for a draw. Total the points earned.

leaguePoints(wins: int, draws: int) → int

Go needs a compiler and Drill does not host one yet, so this page is the reference rather than an exercise: the problem, worked examples, and the solution in full. To type it out, the same problem runs in Python.

Solve it in Python →

Where you start

func leaguePoints(wins int, draws int) int {
	
}

Worked examples

CallResult
leaguePoints(3, 1)10
leaguePoints(0, 0)0
leaguePoints(1, 1)4
leaguePoints(5, 0)15

Hint

Multiply wins by three and add the draws.

Reference solution in Go
func leaguePoints(wins int, draws int) int {
	return 3*wins + draws
}

The same problem in another language

More games problems in Go