fork download
  1. def convert_hex_to_bin(hex_str):
  2. return bin(int(hex_str, 16))[2:].zfill(8)
  3.  
  4.  
  5. def format_bin(bin_str):
  6. return bin_str.replace("1", "x").replace("0", " ")
  7.  
  8.  
  9. def main():
  10. hex_list = ["FF 81 BD A5 A5 BD 81 FF",
  11. "AA 55 AA 55 AA 55 AA 55",
  12. "3E 7F FC F8 F8 FC 7F 3E",
  13. "93 93 93 F3 F3 93 93 93"]
  14.  
  15. for image in hex_list:
  16. for line in image.split():
  17. print(format_bin(convert_hex_to_bin(line)))
  18.  
  19. if __name__ == "__main__":
  20. main()
Success #stdin #stdout 0.1s 10088KB
stdin
Standard input is empty
stdout
xxxxxxxx
x      x
x xxxx x
x x  x x
x x  x x
x xxxx x
x      x
xxxxxxxx
x x x x 
 x x x x
x x x x 
 x x x x
x x x x 
 x x x x
x x x x 
 x x x x
  xxxxx 
 xxxxxxx
xxxxxx  
xxxxx   
xxxxx   
xxxxxx  
 xxxxxxx
  xxxxx 
x  x  xx
x  x  xx
x  x  xx
xxxx  xx
xxxx  xx
x  x  xx
x  x  xx
x  x  xx