Last active
April 11, 2024 23:35
-
-
Save boxpositron/f05b6187254264b371386725b380e004 to your computer and use it in GitHub Desktop.
Revisions
-
boxpositron revised this gist
Apr 11, 2024 . 1 changed file with 13 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,15 @@ from typing import Optional def generate_bit_binaries(size: Optional[int] = 8) -> None: namespace = 2 ** size for i in range(namespace): # 256 because 2^8 = 256 # Format the number as a binary with leading zeros binary_format = f"{i:08b}" print(binary_format) if __name__ == "__main__": generate_bit_binaries() -
boxpositron created this gist
Apr 11, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ def generate_8bit_binaries(): for i in range(256): # 256 because 2^8 = 256 binary_format = f"{i:08b}" # Format the number as a binary with leading zeros print(binary_format) if __name__ == "__main__": generate_8bit_binaries()