bin

Full name
bin
Library
Built-in
Syntax

bin(n)

Description

The bin function converts an integer to its binary representation in text format. The result will be preceded by the characters "0b". If the number is negative, the result will be preceded by the characters "-0b".

Parameters
  • n: integer whose binary representation is to be obtained. It can be positive, zero or negative.
Examples

The first 16 integers starting with zero are converted into their binary representation:

Bin function. Example of use

 

We carry out the same procedure with the 16 negative numbers closest to zero:

Bin function. Example of use

 

Submitted by admin on Sun, 01/20/2019 - 00:13