fork(1) download
  1. MAX_BIT = 8 # for 8 bit I2c communication
  2. #adat = 0x33 # data to be sent
  3. adat = 0x34 # data to be sent
  4.  
  5. binary = lambda n: n > 0 and [n & 1] + binary(n >> 1) or []
  6.  
  7. res = binary(adat)
  8. print(res)
  9. #num = MAX_BIT - len(res)
  10. #cmbnd = [0 for idx in range(num)] + res # combined 8bit
  11. #
  12. #print(cmbnd)
  13.  
Success #stdin #stdout 0.02s 27664KB
stdin
Standard input is empty
stdout
[0, 0, 1, 0, 1, 1]