In my homework for class this week at DaVinci Coders, we were to play with a calculator using variables. I chose to create a function that would define how many slices of pizza are in one pizza, how many slices each person would receive and how many people would be present. The output, then, printed how many pizzas would need to be ordered.
The code read as follows:
What I discovered is that my original code returned an incorrect value because I did not make the integers floating, my answer returned that 4 pizzas would be needed, but that would only be 32 slices and 34 slices were needed total. So I would need 4 whole pizzas and a portion of another. Once I made the integers floating, my answer returned 4.25 pizzas, which is technically correct, but since one cannot order .25 of a pizza, I wanted my answer to round up to the nearest whole number. I found that I could do this by adding .ceil to my answer. Finally, my output gave 5 pizzas, which was the answer I was looking for.