MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / determine_weight

Method determine_weight

example_code/item_121.py:91–97  ·  view source on GitHub ↗
(volume, density)

Source from the content-addressed store, hash-verified

89
90 @staticmethod
91 def determine_weight(volume, density):
92 if density < 0:
93 raise InvalidDensityError("Density must be positive")
94 if volume < 0:
95 raise InvalidVolumeError("Volume must be positive")
96 if volume == 0:
97 density / volume
98
99try:
100 weight = my_module.determine_weight(1, -1)

Callers 1

item_121.pyFile · 0.80

Calls 2

InvalidDensityErrorClass · 0.85
InvalidVolumeErrorClass · 0.85

Tested by

no test coverage detected