bin()

Built-in FunctionPython 2.0+Intermediate

Converts an integer to a binary string prefixed with '0b'

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
print(bin(10))
print(bin(255))
print(bin(-42))

bin() is a built-in function that converts an integer to a binary string prefixed with '0b'.

Try in Playground

Tags

builtinfunctioncore