Question: I used this code but the spaces are wrong, how can I fix them to get the Expected output ? code: digits = ['0', '1',
I used this code but the spaces are wrong, how can I fix them to get the Expected output ?
code:
digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
def integer_to_base(integer_value, base=2): if base 16: return 'Invalid base' result = '' while integer_value > 0: result = digits[integer_value % base] + result integer_value = integer_value // base return result
print('{:10s} {:10s} {:10s} {:10s} {:1s}'.format("ASCII", "Decimal", "Binary", "Octal", "Hex")) for ASCII in range(32, 127): b = integer_to_base(ASCII) o = integer_to_base(ASCII, 8) h = integer_to_base(ASCII, 16) print('{:10s} {:


!['D', 'E', 'F'] def integer_to_base(integer_value, base=2): if base 16: return 'Invalid base'](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e62a7041b_20266f3e62a04d01.jpg)
![result = '' while integer_value > 0: result = digits[integer_value % base]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e62b2bd01_20266f3e62aa8a9b.jpg)
ASCII Hex ! TI Decimal 32 33 34 35 36 37 Binary 100000 100001 100010 100011 100100 100101 100110 Octal 40 41 42 43 44 45 20 21 22 23 24 25 26 38 46 39 100111 27 28 40 47 50 51 101000 101001 41 29 42 101010 52 43 53 44 45 54 55 56 57 2A 2B 2c 2D 2E 2F 30 31 46 47 48 60 61 62 2 V || A : " (0 m 3 0 0 2 4 9 HoS: | - + + + = - 8 63 64 32 33 34 101011 101100 101101 101110 101111 110000 110001 110010 110011 110100 110101 110110 110111 111000 111001 111010 111011 111100 111101 111110 111111 49 50 51 52 53 54 55 56 57 58 59 35 65 66 36 37 38 39 67 70 71 72 73 74 75 76 77 60 3B 3C 3D 61 62 63 3F 64 An 101 41 65 66 67 68 69 70 71 72 42 43 44 45 46 E E G 47 H 48 I J 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 K 73 74 75 76 77 78 79 49 4A 4B 4C 4D L M N 4E Your output P 8 8 1000001 1000010 1000011 1000100 1000101 1000110 1000111 1001000 1001001 1001010 1001011 1001100 1001101 1001110 1001111 1010000 1010001 1010010 1010011 1010100 1010101 1010110 1010111 1011000 1011001 1011010 1011011 1011100 1011101 1011110 1011111 1100000 1100001 122 80 81 82 83 84 85 86 4F 50 51 52 53 54 55 56 S T UT 123 124 125 126 127 130 131 132 W 87 OG > > > N
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
