Binary Conversion in Python

Level 114 keystrokes

This converts an integer to its binary representation using the bin() function.

Python code

# bin() converts an integer to a binary string starting with 0b
# 10 is 1010 in binary (8 + 2), so 0b1010 is printed
1print(bin(10))

Output

0b1010
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • (× 2
  • )× 2

More Python examples at level 1

← Python typing practice