Python bin() Function

❮ Built-in Functions


Example

Return the binary version of 36:

x = bin(36)
Try it Yourself »

Definition and Usage

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

The result will always start with the prefix 0b.


Syntax

bin(n)

Parameter Values

Parameter Description
n Required. An integer

❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.