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

Function careful_divide

example_code/item_032.py:51–55  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

49
50print("Example 1")
51def careful_divide(a, b):
52 try:
53 return a / b
54 except ZeroDivisionError:
55 return None
56
57
58assert careful_divide(4, 2) == 2

Callers 1

item_032.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected