Hi experts, need your help with Python. Code guide is given at the picture and sample input and output. 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...!!! Constraints The given word will only contain characters from the ASCII table with values between 32 and 126. len(word) Output Format The program will print one line for each character from the user input with the following format: :-

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hi experts, need your help with Python. Code guide is given at the picture and sample input and output.

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...!!!

Constraints

The given word will only contain characters from the ASCII table with values between 32 and 126. len(word)

Output Format

The program will print one line for each character from the user input with the following format:

<character>:<asciidecimalvalue>-<asciibinaryvalue>
Sample Input 0
t#3 qulck ÞROWN foX 7uMp3D...!!!
Sample Output 0
t: 116
1110100
#: 35
100011
3: 51
110011
: 32
100000
q: 113
u: 117
1110001
- 1110101
1: 49
110001
c: 99
1100011
K: 75
1001011
: 32
100000
b: 98
1100010
R: 82
1010010
0: 48
110000
w: 119
N: 78
1110111
1001110
: 32
100000
f: 102
1100110
o:
111
1101111
X: 88
1011000
: 32
7: 55
100000
110111
u:
117
1110101
M: 77
1001101
p: 112
1110000
3: 51
110011
D: 68
1000100
.: 46
101110
.: 46
101110
.: 46
101110
!: 33
100001
!: 33
!: 33
100001
100001
Sample Input 1
Transcribed Image Text:Sample Input 0 t#3 qulck ÞROWN foX 7uMp3D...!!! Sample Output 0 t: 116 1110100 #: 35 100011 3: 51 110011 : 32 100000 q: 113 u: 117 1110001 - 1110101 1: 49 110001 c: 99 1100011 K: 75 1001011 : 32 100000 b: 98 1100010 R: 82 1010010 0: 48 110000 w: 119 N: 78 1110111 1001110 : 32 100000 f: 102 1100110 o: 111 1101111 X: 88 1011000 : 32 7: 55 100000 110111 u: 117 1110101 M: 77 1001101 p: 112 1110000 3: 51 110011 D: 68 1000100 .: 46 101110 .: 46 101110 .: 46 101110 !: 33 100001 !: 33 !: 33 100001 100001 Sample Input 1
def char_to_ascii(data_list):
ascii_values= []
for value in data_list:
converted_value
### Do not modify anything above this line ###
# insert your code here #
### Do not modify anything below this line ###
ascii_values.append (converted_value)
return ascii_values
def ascii_to_binary(data_list):
binary_values= []
for value in data_list:
converted_value = ''
### Do not modify anything above this line ###
# insert your code here #
### Do not modify anything below this line ###
binary_values.append (converted_value)
return binary_values
if
-_name__
"__main__":
input()
==
word =
ascii_data = char_to_ascii(word)
binary_data = ascii_to_binary (ascii_data)
for character, ascii, binary in zip(word, ascii_data, binary_data):
print('{}: {} - {}'.format(character, ascii, binary))
Transcribed Image Text:def char_to_ascii(data_list): ascii_values= [] for value in data_list: converted_value ### Do not modify anything above this line ### # insert your code here # ### Do not modify anything below this line ### ascii_values.append (converted_value) return ascii_values def ascii_to_binary(data_list): binary_values= [] for value in data_list: converted_value = '' ### Do not modify anything above this line ### # insert your code here # ### Do not modify anything below this line ### binary_values.append (converted_value) return binary_values if -_name__ "__main__": input() == word = ascii_data = char_to_ascii(word) binary_data = ascii_to_binary (ascii_data) for character, ascii, binary in zip(word, ascii_data, binary_data): print('{}: {} - {}'.format(character, ascii, binary))
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education