In this activity, you will complete the following template functions: • 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]] Hint: you can solve each of these using Python's in-built functions.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

How to apply this python code?

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 #
        print (char, ord(char))
        ### 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 #
        print(ord, char(ord))
        ### Do not modify anything below this line ###
        binary_values.append(converted_value)
    return binary_values

if __name__ == "__main__":
    word = input()
    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))

In this activity, you will complete the following template functions:
• 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]]
Hint: you can solve each of these using Python's in-built functions.
Transcribed Image Text:In this activity, you will complete the following template functions: • 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]] Hint: you can solve each of these using Python's in-built functions.
Sample Input 1
a
Sample Output 1
a: 97 - 1100001
Sample Input 2
ABC
Sample Output 2
A: 65 -
1000001
B: 66
C: 67
1000010
1000011
Transcribed Image Text:Sample Input 1 a Sample Output 1 a: 97 - 1100001 Sample Input 2 ABC Sample Output 2 A: 65 - 1000001 B: 66 C: 67 1000010 1000011
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY