mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
14 lines
No EOL
274 B
Python
14 lines
No EOL
274 B
Python
import pysnooper
|
|
|
|
@pysnooper.snoop()
|
|
def number_to_bits(number):
|
|
if number:
|
|
bits = []
|
|
while number:
|
|
number, remainder = divmod(number, 2)
|
|
bits.insert(0,remainder)
|
|
return bits
|
|
else:
|
|
return [0]
|
|
|
|
number_to_bits(6) |