fork(3) download
  1. hexToBinArray = {'0': '0000', '1': '0001', '2': '0010', '3': '0011',
  2. '4': '0100', '5': '0101', '6': '0110', '7': '0111',
  3. '8': '1000', '9': '1001', 'A': '1010', 'B': '1011',
  4. 'C': '1100', 'D': '1101', 'E': '1110', 'F': '1111'}
  5. toDecode = ['FF 81 BD A5 A5 BD 81 FF', 'AA 55 AA 55 AA 55 AA 55', '3E 7F FC F8 F8 FC 7F 3E', '93 93 93 F3 F3 93 93 93']
  6.  
  7. htba = hexToBinArray
  8.  
  9. def bitmap(string):
  10. hexList = string.split(" ")
  11. i = 0
  12.  
  13. while i < len(hexList):
  14. hexList[i] = list(hexList[i])
  15. i += 1
  16.  
  17. i = 0
  18.  
  19. while i < len(hexList):
  20. p1 = htba[hexList[i][0]]
  21. p2 = htba[hexList[i][1]]
  22. fi = p1+p2
  23. hexList[i] = fi
  24. i += 1
  25.  
  26. i = 0
  27.  
  28. while i < len(hexList):
  29. temp = ''
  30. for value in hexList[i]:
  31. if value == '0':
  32. temp = temp + ' '
  33. else:
  34. temp = temp + 'x'
  35. hexList[i] = temp
  36. i += 1
  37.  
  38. for x in hexList:
  39. print(x)
  40.  
  41. if __name__ == "__main__":
  42. for x in toDecode:
  43. bitmap(x)
Success #stdin #stdout 0.03s 9440KB
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