02 Checkpoint: Calling Functions

Purpose

Check your understanding of calling built-in Python functions and functions that are in a standard Python module.

Problem Statement

In our modern world economy, many items are manufactured in large factories, then packed in boxes and shipped to distribution centers and retail stores. A common question for employees who pack items is “How many boxes do we need?”

Assignment

A manufacturing company needs a program that will help its employees pack manufactured items into boxes for shipping. Write a Python program named boxes.py that asks the user for two integers:

  1. the number of manufactured items
  2. the number of items that the user will pack per box

Your program must compute and print the number of boxes necessary to hold the items. This must be a whole number. Note that the last box may be packed with fewer items than the other boxes.

Helpful Documentation

Testing Procedure

Verify that your program works correctly by following each step in this testing procedure:

  1. Run your program and enter the inputs shown below. Ensure that your program’s output matches the output below.
    > python boxes.py
    Enter the number of items: 8
    Enter the number of items per box: 5
    
    For 8 items, packing 5 items in each box, you will need 2 boxes.
    
    > python boxes.py
    Enter the number of items: 25
    Enter the number of items per box: 4
    
    For 25 items, packing 4 items in each box, you will need 7 boxes.

Sample Solution

When your program is finished, view the sample solution for this assignment to compare your solution to that one. Before looking at the sample solution, you should work to complete this checkpoint program. However, if you have worked on it for at least an hour and are still having problems, feel free to use the sample solution to help you finish your program.

Ponder

During this assignment, you wrote code that calls the math.ceil() function. What did the math.ceil() function do in your program? If the math.ceil() function didn’t exist, would this assignment have been more difficult to complete?

Submission

When complete, report your progress in the associated I‑Learn quiz.