MCPcopy Create free account
hub / github.com/bterwijn/memory_graph / binary

Function binary

images/binary.py:5–12  ·  view source on GitHub ↗
(value: int)

Source from the content-addressed store, hash-verified

3mg.config.type_to_horizontal[list] = True # horizontal lists
4
5def binary(value: int) -> typing.List[int]:
6 mg.render(mg.stack(), 'binary.png', numbered=True)
7 if value == 0:
8 return []
9 quotient, remainder = divmod(value, 2)
10 result = binary(quotient) + [remainder]
11 mg.render(mg.stack(), 'binary.png', numbered=True)
12 return result
13
14print( binary(100) )

Callers 1

binary.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected