Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bslatkin/effectivepython
/ determine_weight
Function
determine_weight
example_code/item_121.py:52–54 ·
view source on GitHub ↗
(volume, density)
Source
from the content-addressed store, hash-verified
50
print(
"Example 1"
)
51
# my_module.py
52
def
determine_weight(volume, density):
53
if
density <= 0:
54
raise
ValueError(
"Density must be positive"
)
55
56
57
try
:
Callers
1
item_121.py
File · 0.85
Calls
3
InvalidDensityError
Class · 0.85
InvalidVolumeError
Class · 0.85
NegativeDensityError
Class · 0.85
Tested by
no test coverage detected