fork download
  1. for bytes in [1, 2, 4, 8]:
  2. bits = 8 * bytes
  3. unsigned_min = 0
  4. unsigned_max = 2**bits - 1
  5. signed_min = - 2**(bits - 1)
  6. signed_max = 2**(bits - 1) - 1
  7. print('For', bytes, 'bytes or', bits, 'bits, unsigned range is', unsigned_min, 'to', unsigned_max)
  8. print('For', bytes, 'bytes or', bits, 'bits, signed range is', signed_min, 'to', signed_max)
  9.  
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
For 1 bytes or 8 bits, unsigned range is 0 to 255
For 1 bytes or 8 bits, signed range is -128 to 127
For 2 bytes or 16 bits, unsigned range is 0 to 65535
For 2 bytes or 16 bits, signed range is -32768 to 32767
For 4 bytes or 32 bits, unsigned range is 0 to 4294967295
For 4 bytes or 32 bits, signed range is -2147483648 to 2147483647
For 8 bytes or 64 bits, unsigned range is 0 to 18446744073709551615
For 8 bytes or 64 bits, signed range is -9223372036854775808 to 9223372036854775807