# Why he used a 5 for the pizzas

Why does he use 5, didn´t get the idea

I mean, if we divide 16 / 6 slices = 2.6

but, if we know that the pizza shop produce only pizzas with 6 slices

6 * 3 = 18

If we take in count what he proposed he is summing 5 slices more with the 5 inicially, why this movement?

Hey Arnaldo,

Thank you for the question!

The pizza shop only offers pizzas that have 6 slices. Therefore, the possible number of slices that one could get is 6, 12, 18, 24, 30, ... Imagine that we do not know a priori what the value of `total_slices`

is. Whichever the value, we want to make sure that everybody gets a piece.

Let's change the task a little and say that we have only two friends - Bob and Ann. Bob will eat 4 slices, Ann will eat 3 slices and so `total_slices = 7`

. We want to figure out the number of pizzas we need. 7//6 = 1, that won't be enough. 8//6 = 1 -> that won't be enough either. The number that will ensure we obtain 2 is 5 -> (7+5)//6 = 2. The nice thing about adding 5 is that, regardless of the value of `total_slices`

, it will always help you get the correct amounts of pizzas.

In the example above, one can argue that all numbers from 5 through 10 would have done the job. That is true unless we change the number of total slices from 7 to 11. We would still need two pizzas. However, (11+10)//6 = 3, whereas (11+5)//6 = 2.

Hope this helps!

Kind regards,

365 Hristina

i would say it is 5 because we want to count the pizzas where at least one slice has been eaten which is 6-1.

A slightly longer alternative that I think generalizes to any combination of pizza slices required and slices per pizza

total_slices = int(input("Total pizza slices required: "))

slices_per_pizza = int(input("Slices per pizza: "))

remainder = total_slices % slices_per_pizza

if remainder == 0:

number_of_pizzas = total_slices // slices_per_pizza

else:

number_of_pizzas = (total_slices // slices_per_pizza) + 1

slices_left = number_of_pizzas * slices_per_pizza - total_slices

print('Number of pizzas required is',number_of_pizzas,'there will be',slices_left,</span>

'remaining slices.')