Here is my version of the code
num_of_persons = int (input ('Enter the number of persons:/n>>> '))
slices_per_person = int (input ('Enter the number of slices per person:/n>>> '))
slices_per_pizza = int (input ('Enter the number of slices per pizza:/n>>> '))
total_slices_required = num_of_persons * slices_per_person
if total_slices_required % slices_per_pizza != 0:
num_of_pizzas = ( total_slices_required + slices_per_pizza ) // slices_per_pizza
else:
num_of_pizzas = total_slices_required // slices_per_pizza
slices_left = num_of_pizzas * slices_per_pizza - total_slices_required
print ('Total number of pizzas required: ' + str (num_of_pizzas))
print ('Total slices left: ' + str (slices_left))
0 answers ( 0 marked as helpful)