Logo

Programming-Idioms

History of Idiom 76 > diff from v31 to v32

Edit summary for version 32 by :

Version 31

2015-10-31, 14:31:43

Version 32

2015-11-30, 12:37:30

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Code
s = '{:b}'.format(x)
Code
s = '{:b}'.format(x)
Doc URL
https://docs.python.org/3/library/string.html#formatstrings
Doc URL
https://docs.python.org/3/library/string.html#formatstrings
Origin
https://docs.python.org/3/library/string.html#formatstrings
Origin
https://docs.python.org/3/library/string.html#formatstrings