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.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s