Logo

Programming-Idioms

History of Idiom 76 > diff from v69 to v70

Edit summary for version 70 by programming-idioms.org:
[Python] +DemoURL

Version 69

2020-11-25, 22:02:10

Version 70

2020-11-25, 22:04:49

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"

Variables
s,x
Variables
s,x
Extra Keywords
int radix
Extra Keywords
int radix
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
Demo URL
https://repl.it/@ProgIdioms/ElderlyAnguishedEllipses