Jul-08-2020, 06:16 PM
def volume_per_container(kg_cargo_per_cubic_metre): """Given the kg of cargo per cubic metre, calculate how many cubic metres of cargo can be stored in a single container.""" # INSERT YOUR CODE BELOW FOR CALCULATING THE # TOTAL VOLUME AND RETURNING THE RESULT (DO NOT CHANGE # THE HEADER OF THE FUNCTION WHICH HAS BEEN PROVIDED FOR YOU # ABOVE) # DO NOT CHANGE THE CODE BELOW # The code below automatically tests your function # following the approach described in # Block 2 Part 4 (Page 207 and further). # If you run this file before making any changes to # it, you will get an AssertionError. # Once you have completed the file with correct # code, the AssertionError should no longer appear and # message "tests passed" will appear in the shell. def test_volume_per_container(): """Test the volume_per_container function.""" # Test for gravel at 1800 kg per cubic metre assert volume_per_container (1800) == 14.555 # Test for wood chips at 380 kg per cubic metre print ("tests passed") test_volume_per_container()