Created
April 25, 2017 13:33
-
-
Save pmutua/968150246b11b2d6f460b335bcfc9b3e to your computer and use it in GitHub Desktop.
Algorithm to convert decimal numbers between 0 and 255 to their binary equivalents.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_converter(dec): | |
if dec < 0 or dec > 255: | |
return "Invalid input"; | |
return "{0:b}".format(dec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment