Question: Code in Python. Code should allow for the input of other test values. Code can use libraries to accomplish the the task of converting to
Code in Python. Code should allow for the input of other test values. Code can use libraries to accomplish the the task of converting to ASCII or Binary. Code should be able to take input of either ASCII or Binary or words or string of letters and convert them to the correct output for the functions below.
Function 1 (String List of characters): it takes as input an arbitrary length string and outputs a list of characters, or vice versa. For example,
Input string: hello world
Output list: [h, e, l, l, o, , w, o, r, l, d]
, or
Input list: [h, e, l, l, o, , w, o, r, l, d] Output string: hello world
You can check a type of input or use the second parameter to let the function know the type of input.
Function 2 (List of characters ASCII): it takes as input a list of characters and outputs a list of corresponding ASCII codes, or vice versa. For example,
Input list: [h, e, l, l, o, , w, o, r, l, d]
Output list: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
, or
Input list: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
Output list: [h, e, l, l, o, , w, o, r, l, d]
Function 3 (ASCII Binary): it takes as input a list of ASCII codes and outputs a list of binary numbers, or vice versa. For example,
Input list: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
Output list: [1101000, 1100101, 1101100, 1101100, 1101111, 100000, 1110111, 1101111,
1110010, 1101100, 1100100]
, or
Input list: [1101000, 1100101, 1101100, 1101100, 1101111, 100000, 1110111, 1101111,
1110010, 1101100, 1100100]
Output list: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
