Python bin() Function

Example

Returns the binary version of 67:

x = bin(67)

Run Instance

Definition and Usage

The bin() function returns the binary version of the specified integer.

The result will always start with the prefix 0b.

Syntax

bin(n)

Parameter Value

Parameter Description
n Required. Integer.