← Back to challenges

Hex to Binary

PythonHardbit_operations

Instructions

Create a function that will take a HEX number and returns the binary equivalent (as a string).

Examples

to_binary(0xFF) ➞ "11111111"

to_binary(0xAA) ➞ "10101010"

to_binary(0xFA) ➞ "11111010"

Notes

The number will be always an 8-bit number.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sum of Missing Numbers