Hi experts, need your help with Python. Code guide is given at the picture and sample input and output.
THE RESULTING BINARY STRING SHOULD HAVE AN 8 CHARACTERS.
Using
char_to_ascii()
, write a program that converts each character in the given string word into its integer counterpart (ASCII decimal value) and returns them in the list ascii_values.
Using
ascii_to_binary()
, write a program that will convert the given list,
ascii_values, into strings containing their binary values and return the converted values in the list
binary_values. e.g. the list [4, 3, 1] will be returned as [‘100’, ‘11’, ‘1’]]
Input Format
The user will enter the sentence in one line.
Example:
t#3qu1cKbR0wNfoX7uMp3D...!!!
The given word will only contain characters from the ASCII table with values between 32 and 126. len(word)
The program will print one line for each character from the user input with the following format:
Extracted text: [75, 98, 105, 111, 108, 124, 90, 108, 111, 111, 97] ['01001011', '01100010', '01101001’, '01101111’, '01101100', '01111100', *01011010', '01101100', '01101111’, '01101111’, '01100001'] 'Kbiol|Zlooa'