I can’t use collection, counter, or dictionary input is
pooiiiuuuuyyyyyttttttrrrrrrreeeeeeeewwwwwwwwwqqqqqqqqqq
the output is
Sorted frequency of letters in code text:
(‘Q’, 10) (‘W’, 9) (‘E’, 8) (‘R’, 7) (‘T’, 6) (‘Y’, 5) (‘U’, 4) (‘I’, 3)
(‘O’, 2) (‘P’, 1) (‘A’, 0) (‘B’, 0) (‘C’, 0) (‘D’, 0) (‘F’, 0) (‘G’, 0)
(‘H’, 0) (‘J’, 0) (‘K’, 0) (‘L’, 0) (‘M’, 0) (‘N’, 0) (‘S’, 0) (‘V’, 0)
(‘X’, 0) (‘Z’, 0)
Encode:
[‘Q’, ‘W’, ‘E’, ‘R’, ‘T’, ‘Y’, ‘U’, ‘I’, ‘O’, ‘P’, ‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘G’, ‘H’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘S’, ‘V’, ‘X’, ‘Z’]
Decode:
[‘K’, ‘L’, ‘M’, ‘N’, ‘C’, ‘O’, ‘P’, ‘Q’, ‘H’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘I’, ‘J’, ‘A’, ‘D’, ‘W’, ‘E’, ‘G’, ‘X’, ‘B’, ‘Y’, ‘F’, ‘Z’]
Please enter a message to encode: This is a test.
LIOK OK Q LTKL.
Please enter a message to decode: LIOK OK Q LTKL.
THIS IS A TEST.
Please enter a message to encode: SKIP
Please enter a message to decode: EXIT
This program will self destruct in 10 seconds…
DO NOT MODIFY ANYTHING BELOW HERE
def main():
codebook = input("Please enter the codebook: ") print(codebook) freq = analyze(codebook) printFreq(freq) encode, decode = assign(freq) print("Encode:") print(encode) print("Decode:") print(decode) while (True): enc = input("Please enter a message to encode: ") print(enc) if enc == "EXIT": break if enc != "SKIP": coded = codeme(encode, enc) print(coded) dec = input("Please enter a message to decode: ") print(dec) if dec == "EXIT": break if dec != "SKIP": coded = decodeme(decode, dec) print(coded) print("This program will self destruct in 10 seconds...")
main()