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

Function binary

src/binary_convert.py:4–8  ·  view source on GitHub ↗
(value: int)

Source from the content-addressed store, hash-verified

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

Callers 1

binary_convert.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected