An art supplier can divide 37.5 kg of clay among cartons, each holding at most 8.0 kg. The following Python code calculates packing quantities. Here floor rounds down to an integer and ceil rounds up to an integer.
import math as m from math import floor as complete mass = 37.5 capacity = 8.0 full = complete(mass / capacity) cartons = m.ceil(mass / capacity) unused = cartons * capacity - mass
Find full, the number of completely filled cartons, and cartons, the total number needed, as exact integers. Find unused, the total unused capacity in kg, to one decimal place. Ignore carton mass and packing losses.
Unlock full course notes by signing up
Track the names an import introduces
Each Python statement below runs separately in a fresh session. Enter the single name that the statement makes directly available for later use. Enter only the name, without parentheses or a dotted expression.
Locate the cause of an import-related error
A packing application can successfully import a local file named supplies.py, which contains only this assignment:
No module named missing_supplies is available. Each snippet below runs separately in a fresh Python interpreter. Enter the exception class raised by each snippet: ModuleNotFoundError, ImportError, or AttributeError.
Snippet A
Separate an imported value from a module attribute
A project contains a Python module named local_rates.py whose entire contents are shown below:
In a fresh session, a booking program then runs this code successfully:
Which statements are true immediately afterward? Select every true statement. Assume no other imports or assignments occur.
Change the search path after importing
A school shop has two different files named pricing.py. Their complete contents are shown below.
File /class/shop/pricing.py
File /class/shared/pricing.py