Skip to content

Instantly share code, notes, and snippets.

@llimllib

llimllib/binary.py

Created Aug 3, 2018
Embed
What would you like to do?
def b(integral):
res = []
while integral > 0:
integral, mod = divmod(integral, 2)
res.insert(0, "1" if mod else "0")
return "".join(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment