(value: int)
| 3 | mg.config.type_to_horizontal[list] = True # horizontal lists |
| 4 | |
| 5 | def 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 | |
| 14 | print( binary(100) ) |