[Python] Distribute an integer amount by a set of slots as evenly as possible

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to figure an elegant way of implementing the distribution of an amount into a given set of slots in python.

    For example:

    7 oranges distributed onto 4 plates would return:

    [2, 2, 2, 1]


    10 oranges across 4 plates would be:

    [3, 3, 2, 2]

    Continue reading...

Compartilhe esta Página