All challenges

Saturday, 21 November 2026

Past

Three rungs, one idea. Solving rung 1 counts. Climb as far as you can.

Splitting Into Teams

lists + groups of n

Rung 1Daily goal5 points

The first team

Write a function called first_team

Return the first n players as a list. If there are fewer than n players, return all of them. [1, 2, 3, 4, 5] with an n of 3 gives [1, 2, 3], and an empty list gives an empty list.

Examples

InputOutput
[1, 2, 3, 4, 5], 3[1, 2, 3]
["ana", "bo", "cy", "dee"], 2["ana", "bo"]
[], 2[]
["ana"], 4["ana"]

There are extra hidden tests, so make it work in general, not just for these.

Rung 2Bonus7 points

Make all the teams

Write a function called make_teams

Split the players into teams of n, in order, and return a list of the teams. The last team can be smaller if the players do not divide evenly. [1, 2, 3, 4, 5] with an n of 2 gives [[1, 2], [3, 4], [5]], and no players gives [].

Examples

InputOutput
[1, 2, 3, 4, 5, 6], 3[[1, 2, 3], [4, 5, 6]]
[1, 2, 3, 4, 5], 2[[1, 2], [3, 4], [5]]
[], 3[]
["ana"], 2[["ana"]]

There are extra hidden tests, so make it work in general, not just for these.

Rung 3Bonus10 points

Team totals

Write a function called team_totals

Split the numbers into teams of n, in order, and return the total of each team. The last team can be smaller. [1, 2, 3, 4, 5] with an n of 2 gives [3, 7, 5], and no numbers gives [].

Examples

InputOutput
[1, 2, 3, 4, 5, 6], 3[6, 15]
[5, 1, 2], 2[6, 2]
[], 4[]
[9], 3[9]

There are extra hidden tests, so make it work in general, not just for these.

Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.