Page 1 of 1

Use python programming language

Posted: Sat Nov 27, 2021 2:34 pm
by answerhappygod
Use python programming language
Use Python Programming Language 1
Use Python Programming Language 1 (72.07 KiB) Viewed 98 times
Use Python Programming Language 2
Use Python Programming Language 2 (6.24 KiB) Viewed 98 times
Use Python Programming Language 3
Use Python Programming Language 3 (19.36 KiB) Viewed 98 times
Use Python Programming Language 4
Use Python Programming Language 4 (20.74 KiB) Viewed 98 times
Details: Name your program as "hmencoder". Usage of hmencoder: hmencoder (input_file] where input_file is the file containing the input message. The input message contains normal English text. You need to encode all English letters together with all printable characters such as "", ";", "!", space etc. The capital letter and the corresponding small letter are treated as two symbols. For example, "A" and "a" are regarded as two symbols. • The output of hmencoder should have two output files, "code.txt" and "encodemsg.txt". • The output file "code.txt" stores the codeword for each symbol and the average number of bits used for each symbol. The format of this output file is as follows: Each row contains the codeword for a separate symbol, the symbols are listed according to the increasing order of the corresponding ASCII code value. The last row shows the average number of bits used for each symbol. E.g. Space: 000 1: 001 A: 0100 z: 1000 Ave = 3.43 bits per symbol • The output file "encodemsg.txt" stores the encoded message with 80 0/1 characters on each row (except the last row). *Important": (i) We use the letter with the smallest ASCII code as the representative of a subtree; (ii) in case of ambiguity, select the two trees with the smallest representatives and when combining the two trees, the one with the smaller representative will be on the left [left = 0, right = 1). • A sample input file and the corresponding output files will be given in the moodle webpage.

test2_input_file - Notepad File Edit Format View Help I don't like programming!

test2_encodemsg1 - Notepad File Edit Format View Help 1001000010100010111110001011100011011110011010101010000110 111011001111101110000

test2_code - Notepad File Edit Format View Help space: 000 !: 10000 : 10001 I: 10010 a: 10011 d: 10100 e: 10101 g: 1011 i: 1100 k: 11010 11: 11011 m: 1110 n: 1111 o: 010 p: 0110 r: 001 t: 0111 Ave = 4.040 bits per symbol =