Last active
April 11, 2024 23:35
-
-
Save boxpositron/f05b6187254264b371386725b380e004 to your computer and use it in GitHub Desktop.
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 characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment