OP 09 June, 2022 - 07:22 AM
I coded this as a sort of continued project from my last one
Let me know if you find any bugs
Code:
text=list(' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890')
binary='100000 1100001 1100010 1100011 1100100 1100101 1100110 1100111 1101000 1101001 1101010 1101011 1101100 1101101 1101110 1101111 1110000 1110001 1110010 1110011 1110100 1110101 1110110 1110111 1111000 1111001 1111010 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 110001 110010 110011 110100 110101 110110 110111 111000 111001 110000'.split()
decimal='32 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 49 50 51 52 53 54 55 56 57 48'.split()
hexadecimal='20 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 31 32 33 34 35 36 37 38 39 30'.split()
unicode='U+20 U+61 U+62 U+63 U+64 U+65 U+66 U+67 U+68 U+69 U+6A U+6B U+6C U+6D U+6E U+6F U+70 U+71 U+72 U+73 U+74 U+75 U+76 U+77 U+78 U+79 U+7A U+41 U+42 U+43 U+44 U+45 U+46 U+47 U+48 U+49 U+4A U+4B U+4C U+4D U+4E U+4F U+50 U+51 U+52 U+53 U+54 U+55 U+56 U+57 U+58 U+59 U+5A U+31 U+32 U+33 U+34 U+35 U+36 U+37 U+38 U+39 U+30'.split()
octal='40 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 61 62 63 64 65 66 67 70 71 60'.split()
trword=''
word=input('Phrase to translate:\n')
try:
key=dict(zip(binary,text))
for letter in word.split():
trword+=key[letter]
print('\nBinary\n')
print(trword+'\n')
except KeyError:
pass
try:
key=dict(zip(decimal,text))
for letter in word.split():
trword+=key[letter]
print('\nDecimal\n')
print(trword+'\n')
except KeyError:
pass
try:
key=dict(zip(hexadecimal,text))
for letter in word.split():
trword+=key[letter]
print('\nHexadecimal\n')
print(trword+'\n')
except KeyError:
pass
try:
key=dict(zip(unicode,text))
for letter in word.split():
trword+=key[letter]
print('\nUnicode Notation\n')
print(trword+'\n')
except KeyError:
pass
try:
key=dict(zip(octal,text))
for letter in word.split():
trword+=key[letter]
print('\nOctal\n')
print(trword)
except KeyError:
pass
d=input('\nPress enter to finish ')
Let me know if you find any bugs