binary

binary

A module that returns numbers as binary representation.

Converts a non-negative integer into its binary representation, returned as a string. Useful for understanding base-2 representations and bit-level reasoning.

Functions

Name Description
binary >> Covert whole number to binary representation.

binary

binary.binary(num)

Covert whole number to binary representation.

Parameters

Name Type Description Default
num int The number to convert. required

Returns

Name Type Description
string The converted string representation of the number.

Examples

>>> binary(15)
"1111"